aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-12-24 04:58:09 +0000
committerMatthew Wild <mwild1@gmail.com>2010-12-24 04:58:09 +0000
commit84b19928a500c595c1348bbef05c36a5484199e8 (patch)
tree90a9c436a7a14df1501366a026e30d73e6fde43d /core
parentec15ee49795f6adde327b1731dcea6ec894346b8 (diff)
downloadprosody-84b19928a500c595c1348bbef05c36a5484199e8.tar.gz
prosody-84b19928a500c595c1348bbef05c36a5484199e8.zip
s2smanager: Destroy session on immediate failure of a connection attempt (e.g. inability to create sockets)
Diffstat (limited to 'core')
-rw-r--r--core/s2smanager.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index dc0bf3d9..2af5ec1a 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -305,7 +305,13 @@ function try_connect(host_session, connect_host, connect_port)
if reply and reply[#reply] and reply[#reply].a then
log("debug", "DNS reply for %s gives us %s", connect_host, reply[#reply].a);
- return make_connect(host_session, reply[#reply].a, connect_port);
+ local ok, err = make_connect(host_session, reply[#reply].a, connect_port);
+ if not ok then
+ if not attempt_connection(host_session, err or "closed") then
+ err = err and (": "..err) or "";
+ destroy_session(host_session, "Connection failed"..err);
+ end
+ end
else
log("debug", "DNS lookup failed to get a response for %s", connect_host);
if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can