Don't error if the original s2s connection has closed before we get the dialback result

Wed, 19 Nov 2008 21:07:40 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 19 Nov 2008 21:07:40 +0000
changeset 347
fba39fda0879
parent 346
22c8f7d412a1
child 348
aab28eacd84e

Don't error if the original s2s connection has closed before we get the dialback result

plugins/mod_dialback.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_dialback.lua	Wed Nov 19 05:34:00 2008 +0000
+++ b/plugins/mod_dialback.lua	Wed Nov 19 21:07:40 2008 +0000
@@ -55,8 +55,12 @@
 				log("warn", "dialback for "..(origin.dialback_verifying.from_host or "(unknown)").." failed");
 				valid = "invalid";
 			end
-			origin.dialback_verifying.sends2s(format("<db:result from='%s' to='%s' id='%s' type='%s'>%s</db:result>",
-				attr.from, attr.to, attr.id, valid, origin.dialback_verifying.dialback_key));
+			if not origin.dialback_verifying.sends2s then
+				log("warn", "Incoming s2s session was closed in the meantime, so we can't notify it of the db result");
+			else
+				origin.dialback_verifying.sends2s(format("<db:result from='%s' to='%s' id='%s' type='%s'>%s</db:result>",
+					attr.from, attr.to, attr.id, valid, origin.dialback_verifying.dialback_key));
+			end
 		end
 	end);
 

mercurial