Fix pull-filters

Signed-off-by: Rahix <rahix@rahix.de>
dev
rahix 7 years ago
parent 888ad288af
commit 0eed392d6e

@ -77,7 +77,7 @@ function Network:pull(filter, timeout)
last_msg = serialization.unserialize(msg) last_msg = serialization.unserialize(msg)
return filter(addr_remote, last_msg) return filter(addr_remote, last_msg)
end) end)
if ev ~= "nil" then if ev ~= nil then
return last_msg return last_msg
else else
return nil, "timeout" return nil, "timeout"
@ -189,6 +189,7 @@ function BaseControl:get(noun, timeout)
if remote ~= self.remote_nouns[noun] then return false end if remote ~= self.remote_nouns[noun] then return false end
if msg.ty ~= Message.NounResponse then return false end if msg.ty ~= Message.NounResponse then return false end
if msg.noun ~= noun then return false end if msg.noun ~= noun then return false end
return true
end, timeout) end, timeout)
if answer == nil then if answer == nil then
return nil, err return nil, err
@ -262,9 +263,10 @@ function BaseControl:call_sync(verb, ...)
sync=true, sync=true,
}) })
local answer, err = self.network:pull(function(remote, msg) local answer, err = self.network:pull(function(remote, msg)
if remote ~= self.remote_nouns[noun] then return false end if remote ~= self.remote_verbs[verb] then return false end
if msg.ty ~= Message.NounResponse then return false end if msg.ty ~= Message.VerbResponse then return false end
if msg.noun ~= noun then return false end if msg.verb ~= verb then return false end
return true
end, timeout) end, timeout)
if answer ~= nil then if answer ~= nil then
return table.unpack(answer.ret) return table.unpack(answer.ret)

Loading…
Cancel
Save