From 765749f6080c144ec3bf14c202b7b67c7219c986 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Tue, 4 Nov 2014 18:25:15 +0800 Subject: [PATCH] accept may not start fd, so it can't close at last --- lualib/snax/loginserver.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lualib/snax/loginserver.lua b/lualib/snax/loginserver.lua index 3eafa674..2605a028 100644 --- a/lualib/snax/loginserver.lua +++ b/lualib/snax/loginserver.lua @@ -87,17 +87,16 @@ local function launch_slave(auth_handler) return ok, server, uid, secret end - local function ret_pack(fd, ok, err, ...) + local function ret_pack(ok, err, ...) if ok then skynet.ret(skynet.pack(err, ...)) - elseif err ~= socket_error then - socket.close(fd) + else error(err) end end - skynet.dispatch("lua", function(_,_,fd,...) - ret_pack(fd,pcall(auth,fd,...)) + skynet.dispatch("lua", function(_,_,...) + ret_pack(pcall(auth, ...)) end) end @@ -164,6 +163,7 @@ local function launch_master(conf) if err ~= socket_error then skynet.error(string.format("invalid client (fd = %d) error = %s", fd, err)) end + socket.start(fd) end socket.close(fd) end)