|
|
|
|
@ -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)
|
|
|
|
|
|