aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_event.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-02-23 15:33:02 +0000
committerMatthew Wild <mwild1@gmail.com>2018-02-23 15:33:02 +0000
commit117211cdd664f127b48bfb24119bdaf6e00fb2bd (patch)
tree66dbccd699d40147f9f15b281aca93cfd11c726c /net/server_event.lua
parenta4aeb103dd3274bd174161e9e0f3eff1c5fdca92 (diff)
downloadprosody-117211cdd664f127b48bfb24119bdaf6e00fb2bd.tar.gz
prosody-117211cdd664f127b48bfb24119bdaf6e00fb2bd.zip
net.server_event: Better outgoing connection error handling
Same as 67311cda0625. Check for readability. If a socket is readable after initial connection, it likely means an error, so we call the readcallback for that connection to handle it (and ultimately close).
Diffstat (limited to 'net/server_event.lua')
-rw-r--r--net/server_event.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index fd456deb..bc1cc094 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -105,6 +105,8 @@ function interface_mt:_start_connection(plainssl) -- called from wrapclient
self:ontimeout() -- call timeout listener
self:_close()
debug( "new connection failed. id:", self.id, "error:", self.fatalerror )
+ elseif EV_READWRITE == event then
+ self.readcallback(event);
else
if plainssl and has_luasec then -- start ssl session
self:starttls(self._sslctx, true)
@@ -116,7 +118,7 @@ function interface_mt:_start_connection(plainssl) -- called from wrapclient
self.eventconnect = nil
return -1
end
- self.eventconnect = addevent( base, self.conn, EV_WRITE, callback, cfg.CONNECT_TIMEOUT )
+ self.eventconnect = addevent( base, self.conn, EV_READWRITE, callback, cfg.CONNECT_TIMEOUT )
return true
end
function interface_mt:_start_session(call_onconnect) -- new session, for example after startssl