mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix: don't use global wait_response
This commit is contained in:
@@ -115,16 +115,14 @@ local function dispatch_by_session(self)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local wait_response
|
|
||||||
|
|
||||||
local function pop_response(self)
|
local function pop_response(self)
|
||||||
while true do
|
while true do
|
||||||
local func,co = table.remove(self.__request, 1), table.remove(self.__thread, 1)
|
local func,co = table.remove(self.__request, 1), table.remove(self.__thread, 1)
|
||||||
if func then
|
if func then
|
||||||
return func, co
|
return func, co
|
||||||
end
|
end
|
||||||
wait_response = coroutine.running()
|
self.wait_response = coroutine.running()
|
||||||
skynet.wait(wait_response)
|
skynet.wait(self.wait_response)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -136,9 +134,9 @@ local function push_response(self, response, co)
|
|||||||
-- response is a function, push it to __request
|
-- response is a function, push it to __request
|
||||||
table.insert(self.__request, response)
|
table.insert(self.__request, response)
|
||||||
table.insert(self.__thread, co)
|
table.insert(self.__thread, co)
|
||||||
if wait_response then
|
if self.wait_response then
|
||||||
skynet.wakeup(wait_response)
|
skynet.wakeup(self.wait_response)
|
||||||
wait_response = nil
|
self.wait_response = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user