From 24f9ee1560f588812e3749ed375fdd1846c058bb Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Fri, 8 Jan 2016 18:34:45 +0800 Subject: [PATCH] work thread for channel may not create if you never connect --- lualib/socketchannel.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lualib/socketchannel.lua b/lualib/socketchannel.lua index cf918645..350423a4 100644 --- a/lualib/socketchannel.lua +++ b/lualib/socketchannel.lua @@ -411,10 +411,10 @@ end function channel:close() if not self.__closed then - local thread = assert(self.__dispatch_thread) + local thread = self.__dispatch_thread self.__closed = true close_channel_socket(self) - if not self.__response and self.__dispatch_thread == thread then + if not self.__response and self.__dispatch_thread == thread and thread then -- dispatch by order, send close signal to dispatch thread push_response(self, true, false) -- (true, false) is close signal end