Comparison

core/s2smanager.lua @ 2712:9c579864b20a

s2smanager: Log and fail gracefully when unable to create socket for outgoing s2s connection (thanks foucault)
author Matthew Wild <mwild1@gmail.com>
date Thu, 25 Feb 2010 17:53:27 +0000
parent 2711:5d97fb043141
child 2714:9c5d8e0c146e
child 2760:604db849f111
child 2857:6036c4b75235
comparison
equal deleted inserted replaced
2711:5d97fb043141 2712:9c579864b20a
304 -- Ok, we're going to try to connect 304 -- Ok, we're going to try to connect
305 305
306 local from_host, to_host = host_session.from_host, host_session.to_host; 306 local from_host, to_host = host_session.from_host, host_session.to_host;
307 307
308 local conn, handler = socket.tcp() 308 local conn, handler = socket.tcp()
309
310 if not conn then
311 log("warn", "Failed to create outgoing connection, system error: %s", handler);
312 return false, handler;
313 end
309 314
310 conn:settimeout(0); 315 conn:settimeout(0);
311 local success, err = conn:connect(connect_host, connect_port); 316 local success, err = conn:connect(connect_host, connect_port);
312 if not success and err ~= "timeout" then 317 if not success and err ~= "timeout" then
313 log("warn", "s2s connect() to %s (%s:%d) failed: %s", host_session.to_host, connect_host, connect_port, err); 318 log("warn", "s2s connect() to %s (%s:%d) failed: %s", host_session.to_host, connect_host, connect_port, err);