Skip to content

Commit

Permalink
fix telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Oct 14, 2021
1 parent c38be0c commit c876e0d
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions script/service/net.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,35 @@ end

local m = {}

function m.listen(...)
local fd, err = socket.bind(...)
function m.listen(protocol, ...)
local fd, err = socket(protocol)
if not fd then
return fd, err
return nil, err
end
local ok
ok, err = fd:bind(...)
if not ok then
fd:close()
return nil, err
end
ok, err = fd:listen()
if not ok then
fd:close()
return nil, err
end
return new_listen(fd)
end

function m.connect(...)
local fd, err = socket.connect(...)
function m.connect(protocol, ...)
local fd, err = socket(protocol)
if not fd then
return fd, err
return nil, err
end
local ok
ok, err = fd:connect(...)
if ok == nil then
fd:close()
return nil, err
end
return new_connect(fd)
end
Expand Down

0 comments on commit c876e0d

Please sign in to comment.