Software /
code /
prosody
Comparison
core/s2smanager.lua @ 2472:cde876604bb7
s2smanager: Log error and fail gracefully if we can't open a socket for an outgoing s2s connection (thanks foucault)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 19 Jan 2010 19:58:02 +0000 |
parent | 2469:9e0c0b08f219 |
child | 2509:e8a0f2368cde |
comparison
equal
deleted
inserted
replaced
2471:2aeb55a51f47 | 2472:cde876604bb7 |
---|---|
306 -- Ok, we're going to try to connect | 306 -- Ok, we're going to try to connect |
307 | 307 |
308 local from_host, to_host = host_session.from_host, host_session.to_host; | 308 local from_host, to_host = host_session.from_host, host_session.to_host; |
309 | 309 |
310 local conn, handler = socket.tcp() | 310 local conn, handler = socket.tcp() |
311 | |
312 if not conn then | |
313 log("warn", "Failed to create outgoing connection, system error: %s", handler); | |
314 return false, handler; | |
315 end | |
311 | 316 |
312 conn:settimeout(0); | 317 conn:settimeout(0); |
313 local success, err = conn:connect(connect_host, connect_port); | 318 local success, err = conn:connect(connect_host, connect_port); |
314 if not success and err ~= "timeout" then | 319 if not success and err ~= "timeout" then |
315 log("warn", "s2s connect() to %s (%s:%d) failed: %s", host_session.to_host, connect_host, connect_port, err); | 320 log("warn", "s2s connect() to %s (%s:%d) failed: %s", host_session.to_host, connect_host, connect_port, err); |