Mercurial > prosody-hg
comparison core/s2smanager.lua @ 3960:bb8a064883fc
s2smanager: Destroy session on immediate failure of a connection attempt (e.g. inability to create sockets)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 24 Dec 2010 04:58:09 +0000 |
| parents | 32a2a4f522f8 |
| children | 05a58497a903 |
comparison
equal
deleted
inserted
replaced
| 3959:32a2a4f522f8 | 3960:bb8a064883fc |
|---|---|
| 304 end | 304 end |
| 305 -- end of CNAME resolving | 305 -- end of CNAME resolving |
| 306 | 306 |
| 307 if reply and reply[#reply] and reply[#reply].a then | 307 if reply and reply[#reply] and reply[#reply].a then |
| 308 log("debug", "DNS reply for %s gives us %s", connect_host, reply[#reply].a); | 308 log("debug", "DNS reply for %s gives us %s", connect_host, reply[#reply].a); |
| 309 return make_connect(host_session, reply[#reply].a, connect_port); | 309 local ok, err = make_connect(host_session, reply[#reply].a, connect_port); |
| 310 if not ok then | |
| 311 if not attempt_connection(host_session, err or "closed") then | |
| 312 err = err and (": "..err) or ""; | |
| 313 destroy_session(host_session, "Connection failed"..err); | |
| 314 end | |
| 315 end | |
| 310 else | 316 else |
| 311 log("debug", "DNS lookup failed to get a response for %s", connect_host); | 317 log("debug", "DNS lookup failed to get a response for %s", connect_host); |
| 312 if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can | 318 if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can |
| 313 log("debug", "No other records to try for %s - destroying", host_session.to_host); | 319 log("debug", "No other records to try for %s - destroying", host_session.to_host); |
| 314 err = err and (": "..err) or ""; | 320 err = err and (": "..err) or ""; |
