We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7e4e43 commit d2f2e29Copy full SHA for d2f2e29
lualib/snax/loginserver.lua
@@ -49,7 +49,6 @@ end
49
50
local function launch_slave(auth_handler)
51
local function auth(fd, addr)
52
- fd = assert(tonumber(fd))
53
skynet.error(string.format("connect from %s (fd = %d)", addr, fd))
54
socket.start(fd)
55
@@ -84,11 +83,11 @@ local function launch_slave(auth_handler)
84
83
85
local ok, server, uid = pcall(auth_handler,token)
86
87
- socket.abandon(fd)
88
return ok, server, uid, secret
89
end
90
91
- local function ret_pack(ok, err, ...)
+ local function ret_pack(fd, ok, err, ...)
+ socket.abandon(fd)
92
if ok then
93
skynet.ret(skynet.pack(err, ...))
94
else
@@ -100,8 +99,12 @@ local function launch_slave(auth_handler)
100
99
101
102
103
- skynet.dispatch("lua", function(_,_,...)
104
- ret_pack(pcall(auth, ...))
+ skynet.dispatch("lua", function(_,_,fd,...)
+ if type(fd) ~= "number" then
+ skynet.ret(skynet.pack(false, "invalid fd type"))
105
+ else
106
+ ret_pack(fd,pcall(auth, fd, ...))
107
+ end
108
end)
109
110
0 commit comments