Skip to content

Commit

Permalink
fix the error in running fail_cb in iostream (#324)
Browse files Browse the repository at this point in the history
* fix the error in running fail_cb in iostream

* fix the args of fail_cb when using iostream in dail

* websocket->async: fetch:dns failed, _throw_error duplicate calls

When using websocket, when dns resoved failed, _throw_error duplicate
calls in async: fetch
  • Loading branch information
nijiancong authored and kernelsauce committed Oct 28, 2017
1 parent b6ccaba commit 1f597e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
4 changes: 0 additions & 4 deletions turbo/async.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,6 @@ function async.HTTPClient:_connect()
self._handle_connect,
self._handle_connect_fail,
self)
if rc ~= 0 then
self:_throw_error(errors.COULD_NOT_CONNECT, msg)
return -1
end
elseif self.schema == "wss" then
if not self.ssl_options or not self.ssl_options._ssl_ctx then
self.ssl_options = self.ssl_options or {}
Expand Down
10 changes: 5 additions & 5 deletions turbo/iosimple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function iosimple.dial(address, ssl, io)
ctx:set_arguments({true})
ctx:finalize_context()
end,
function(rc, strerr, errdesc)
ctx:set_arguments({false, rc, strerr, errdesc})
function(errdesc)
ctx:set_arguments({false, errdesc})
ctx:finalize_context()
end
)
Expand All @@ -117,13 +117,13 @@ function iosimple.dial(address, ssl, io)
ctx:set_arguments({true})
ctx:finalize_context()
end,
function(rc, strerr, errdesc)
ctx:set_arguments({false, rc, strerr, errdesc})
function(errdesc)
ctx:set_arguments({false, errdesc})
ctx:finalize_context()
end
)
end
local rc, sockerr, strerr, errdesc = coroutine.yield(ctx)
local rc, errdesc = coroutine.yield(ctx)
if rc ~= true then
error(errdesc)
end
Expand Down
6 changes: 1 addition & 5 deletions turbo/iostream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,7 @@ function iostream.IOStream:_handle_connect_fail(err)
self._connect_callback = nil
self._connect_callback_arg = nil
self._connecting = false
if arg then
cb(arg, err)
else
cb(err)
end
self:_run_callback(cb, arg, err)
end

--- Main event handler for the IOStream.
Expand Down

0 comments on commit 1f597e2

Please sign in to comment.