Update the return values of socket.listen, also return the real port bind to zero (#1638)

This commit is contained in:
zaxbbun
2022-09-03 07:19:03 +08:00
committed by GitHub
parent 6bd6f53ab8
commit c1eeba215d
10 changed files with 30 additions and 18 deletions

View File

@@ -148,8 +148,9 @@ function command.listen(source, addr, port)
local address = assert(node_address[addr], addr .. " is down")
addr, port = string.match(address, "([^:]+):(.*)$")
end
skynet.call(gate, "lua", "open", { address = addr, port = port })
skynet.ret(skynet.pack(nil))
local param = { address = addr, port = port }
skynet.ret(skynet.pack(skynet.call(gate, "lua", "open", param)))
end
function command.sender(source, node)

View File

@@ -11,8 +11,9 @@ skynet.register_protocol {
local handler = {}
function handler.open(source, conf)
function handler.open(source, conf, port)
watchdog = conf.watchdog or source
return port
end
function handler.message(fd, msg, sz)