s2smanager: send_to_host(): Handle already-destroyed session and bounce stanza accordingly

Fri, 24 Dec 2010 04:56:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 24 Dec 2010 04:56:37 +0000
changeset 3958
8bd0b2d4b9b0
parent 3957
b5223a74e07e
child 3959
32a2a4f522f8

s2smanager: send_to_host(): Handle already-destroyed session and bounce stanza accordingly

core/s2smanager.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Fri Dec 24 04:56:02 2010 +0000
+++ b/core/s2smanager.lua	Fri Dec 24 04:56:37 2010 +0000
@@ -126,7 +126,10 @@
 		log("debug", "stanza [%s] queued until connection complete", tostring(data.name));
 		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);
+			if not destroy_session(host_session, "Connection failed") then
+				-- Already destroyed, we need to bounce our stanza
+				bounce_sendq(host_session, host_session.destruction_reason);
+			end
 			return false;
 		end
 	end

mercurial