Skip to content

Commit

Permalink
more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Aug 17, 2018
1 parent 4613fde commit 7b3c163
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lualib/skynet/socketchannel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ local function dispatch_by_session(self)
wakeup_all(self, errormsg)
end
end
self.__dispatch_thread = nil
end

local function pop_response(self)
Expand Down Expand Up @@ -190,7 +189,6 @@ local function dispatch_by_order(self)
wakeup_all(self, errmsg)
end
end
self.__dispatch_thread = nil
end

local function dispatch_function(self)
Expand Down Expand Up @@ -254,7 +252,11 @@ local function connect_once(self)
end

self.__sock = setmetatable( {fd} , channel_socket_meta )
self.__dispatch_thread = skynet.fork(dispatch_function(self), self)
self.__dispatch_thread = skynet.fork(function()
pcall(dispatch_function(self), self)
-- clear dispatch_thread
self.__dispatch_thread = nil
end)

if self.__auth then
self.__authcoroutine = coroutine.running()
Expand Down

0 comments on commit 7b3c163

Please sign in to comment.