Skip to content

Commit 6485041

Browse files
committed
bugfix: wakeup sleep
1 parent acb0c57 commit 6485041

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lualib/http/sockethelper.lua

+4
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,16 @@ function sockethelper.connect(host, port, timeout)
7171
local fd
7272
if timeout then
7373
local drop_fd
74+
local co = coroutine.running()
7475
-- asynchronous connect
7576
skynet.fork(function()
7677
fd = socket.open(host, port)
7778
if drop_fd then
7879
-- sockethelper.connect already return, and raise socket_error
7980
socket.close(fd)
81+
else
82+
-- socket.open before sleep, wakeup.
83+
skynet.wakeup(co)
8084
end
8185
end)
8286
skynet.sleep(timeout)

0 commit comments

Comments
 (0)