Fix pull-filters
Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
parent
888ad288af
commit
0eed392d6e
1 changed files with 6 additions and 4 deletions
10
bc.lua
10
bc.lua
|
|
@ -77,7 +77,7 @@ function Network:pull(filter, timeout)
|
|||
last_msg = serialization.unserialize(msg)
|
||||
return filter(addr_remote, last_msg)
|
||||
end)
|
||||
if ev ~= "nil" then
|
||||
if ev ~= nil then
|
||||
return last_msg
|
||||
else
|
||||
return nil, "timeout"
|
||||
|
|
@ -189,6 +189,7 @@ function BaseControl:get(noun, timeout)
|
|||
if remote ~= self.remote_nouns[noun] then return false end
|
||||
if msg.ty ~= Message.NounResponse then return false end
|
||||
if msg.noun ~= noun then return false end
|
||||
return true
|
||||
end, timeout)
|
||||
if answer == nil then
|
||||
return nil, err
|
||||
|
|
@ -262,9 +263,10 @@ function BaseControl:call_sync(verb, ...)
|
|||
sync=true,
|
||||
})
|
||||
local answer, err = self.network:pull(function(remote, msg)
|
||||
if remote ~= self.remote_nouns[noun] then return false end
|
||||
if msg.ty ~= Message.NounResponse then return false end
|
||||
if msg.noun ~= noun then return false end
|
||||
if remote ~= self.remote_verbs[verb] then return false end
|
||||
if msg.ty ~= Message.VerbResponse then return false end
|
||||
if msg.verb ~= verb then return false end
|
||||
return true
|
||||
end, timeout)
|
||||
if answer ~= nil then
|
||||
return table.unpack(answer.ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue