From e6667d5a32309a5e4123792caefb29af5319be5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Wed, 24 Jul 2013 14:22:04 +0800 Subject: [PATCH] socket.write return nil when write to a closed fd --- lualib/socket.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lualib/socket.lua b/lualib/socket.lua index 7f5956b2..8f415807 100644 --- a/lualib/socket.lua +++ b/lualib/socket.lua @@ -218,7 +218,11 @@ function socket.readline(fd, sep) end function socket.write(fd, msg, sz) + if CLOSED[fd] or not READBUF[fd] then + return + end skynet.send(".socket", "client", fd, msg, sz) + return true end function socket.lock(fd)