Diff

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
line wrap: on
line diff
--- a/core/s2smanager.lua	Tue Jan 19 04:38:43 2010 +0000
+++ b/core/s2smanager.lua	Tue Jan 19 19:58:02 2010 +0000
@@ -308,6 +308,11 @@
 	local from_host, to_host = host_session.from_host, host_session.to_host;
 	
 	local conn, handler = socket.tcp()
+	
+	if not conn then
+		log("warn", "Failed to create outgoing connection, system error: %s", handler);
+		return false, handler;
+	end
 
 	conn:settimeout(0);
 	local success, err = conn:connect(connect_host, connect_port);