Diff

core/s2smanager.lua @ 10425:42cf93ff4618

s2s: Allow passing a custom error for bouncing queued stanzas (#770) Since stream errors and stanza errors are different
author Kim Alvefur <zash@zash.se>
date Sat, 23 Nov 2019 01:29:03 +0100
parent 10304:56522bb3bca5
child 11418:f4b76e500768
line wrap: on
line diff
--- a/core/s2smanager.lua	Wed Nov 20 21:31:46 2019 +0100
+++ b/core/s2smanager.lua	Sat Nov 23 01:29:03 2019 +0100
@@ -84,14 +84,14 @@
 	return setmetatable(session, resting_session);
 end
 
-local function destroy_session(session, reason)
+local function destroy_session(session, reason, bounce_reason)
 	if session.destroyed then return; end
 	local log = session.log or log;
 	log("debug", "Destroying %s session %s->%s%s%s", session.direction, session.from_host, session.to_host, reason and ": " or "", reason or "");
 
 	if session.direction == "outgoing" then
 		hosts[session.from_host].s2sout[session.to_host] = nil;
-		session:bounce_sendq(reason);
+		session:bounce_sendq(bounce_reason or reason);
 	elseif session.direction == "incoming" then
 		if session.outgoing then
 			hosts[session.to_host].s2sout[session.from_host] = nil;