Diff

plugins/mod_s2s.lua @ 12679:7d4a95ba9b6c 0.12

mod_s2s: Fix firing buffer drain events Fixes the same kind of issue as in 65563530375b but once and for all, while improving similarity between incoming and outgoing connections.
author Kim Alvefur <zash@zash.se>
date Fri, 26 Aug 2022 18:53:00 +0200
parent 12474:8fac32810144
child 12680:ca4abc6ab208
child 13110:d5f322dd424b
line wrap: on
line diff
--- a/plugins/mod_s2s.lua	Mon Aug 15 18:56:22 2022 +0200
+++ b/plugins/mod_s2s.lua	Fri Aug 26 18:53:00 2022 +0200
@@ -464,6 +464,7 @@
 		end
 		if session.type == "s2sin_unauthed" and to and not session.to_host then
 			session.to_host = to;
+			session.host = to;
 		elseif to ~= session.to_host then
 			session:close({ condition = "improper-addressing", text = "New stream 'to' attribute does not match original" });
 			return;
@@ -888,8 +889,7 @@
 function listener.onreadtimeout(conn)
 	local session = sessions[conn];
 	if session then
-		local host = session.host or session.to_host;
-		return (hosts[host] or prosody).events.fire_event("s2s-read-timeout", { session = session });
+		return (hosts[session.host] or prosody).events.fire_event("s2s-read-timeout", { session = session });
 	end
 end