From 648504119ec0e31a1472606eabfb0004bb162ac8 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 8 May 2017 11:45:50 +0800 Subject: [PATCH] bugfix: wakeup sleep --- lualib/http/sockethelper.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lualib/http/sockethelper.lua b/lualib/http/sockethelper.lua index 0d8e80fb..0ae6445d 100644 --- a/lualib/http/sockethelper.lua +++ b/lualib/http/sockethelper.lua @@ -71,12 +71,16 @@ function sockethelper.connect(host, port, timeout) local fd if timeout then local drop_fd + local co = coroutine.running() -- asynchronous connect skynet.fork(function() fd = socket.open(host, port) if drop_fd then -- sockethelper.connect already return, and raise socket_error socket.close(fd) + else + -- socket.open before sleep, wakeup. + skynet.wakeup(co) end end) skynet.sleep(timeout)