s2smanager: send_to_host(): Return false on failure, and true otherwise

Wed, 22 Dec 2010 20:38:40 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 22 Dec 2010 20:38:40 +0000
changeset 3947
21391aa2d9bc
parent 3946
14239141764f
child 3948
d0b8fa486458

s2smanager: send_to_host(): Return false on failure, and true otherwise

core/s2smanager.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Wed Dec 22 17:23:55 2010 +0100
+++ b/core/s2smanager.lua	Wed Dec 22 20:38:40 2010 +0000
@@ -106,6 +106,7 @@
 			log("error", "Trying to send a stanza to ourselves??")
 			log("error", "Traceback: %s", get_traceback());
 			log("error", "Stanza: %s", tostring(data));
+			return false;
 		else
 			(host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host);
 			-- FIXME
@@ -126,8 +127,10 @@
 		if (not host_session.connecting) and (not host_session.conn) then
 			log("warn", "Connection to %s failed already, destroying session...", to_host);
 			destroy_session(host_session);
+			return false;
 		end
 	end
+	return true;
 end
 
 local open_sessions = 0;

mercurial