s2smanager: Log and fail gracefully when unable to create socket for outgoing s2s connection (thanks foucault)

Thu, 25 Feb 2010 17:53:27 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 25 Feb 2010 17:53:27 +0000
changeset 2712
9c579864b20a
parent 2711
5d97fb043141
child 2713
1fc95582d74b

s2smanager: Log and fail gracefully when unable to create socket for outgoing s2s connection (thanks foucault)

core/s2smanager.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Thu Feb 25 17:52:33 2010 +0000
+++ b/core/s2smanager.lua	Thu Feb 25 17:53:27 2010 +0000
@@ -306,6 +306,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);

mercurial