mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
Fix #1609
This commit is contained in:
@@ -100,8 +100,10 @@ function server.logout(username)
|
|||||||
local u = user_online[username]
|
local u = user_online[username]
|
||||||
user_online[username] = nil
|
user_online[username] = nil
|
||||||
if u.fd then
|
if u.fd then
|
||||||
gateserver.closeclient(u.fd)
|
if connection[u.fd] then
|
||||||
connection[u.fd] = nil
|
gateserver.closeclient(u.fd)
|
||||||
|
connection[u.fd] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -153,11 +155,15 @@ function server.start(conf)
|
|||||||
handshake[fd] = nil
|
handshake[fd] = nil
|
||||||
local c = connection[fd]
|
local c = connection[fd]
|
||||||
if c then
|
if c then
|
||||||
c.fd = nil
|
|
||||||
connection[fd] = nil
|
|
||||||
if conf.disconnect_handler then
|
if conf.disconnect_handler then
|
||||||
conf.disconnect_handler(c.username)
|
conf.disconnect_handler(c.username)
|
||||||
end
|
end
|
||||||
|
-- double check, conf.disconnect_handler may close fd
|
||||||
|
if connection[fd] then
|
||||||
|
c.fd = nil
|
||||||
|
connection[fd] = nil
|
||||||
|
gateserver.closeclient(fd)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user