work thread for channel may not create if you never connect

This commit is contained in:
Cloud Wu
2016-01-08 18:34:45 +08:00
parent d7a76c7c72
commit 24f9ee1560

View File

@@ -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