Diff

plugins/mod_s2s/mod_s2s.lua @ 7537:a0813737c6fa

mod_s2s: Index session after checking if it exists (fixes traceback in case of a connection without a session having a read timeout)
author Kim Alvefur <zash@zash.se>
date Sun, 07 Aug 2016 20:48:37 +0200 (2016-08-07)
parent 7466:f28fa742def3
child 7542:0f92dc8e8b88
child 7638:a23b5cb8c22b
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Fri Jul 29 13:20:02 2016 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Sun Aug 07 20:48:37 2016 +0200
@@ -642,8 +642,8 @@
 
 function listener.onreadtimeout(conn)
 	local session = sessions[conn];
-	local host = session.host or session.to_host;
 	if session then
+		local host = session.host or session.to_host;
 		return (hosts[host] or prosody).events.fire_event("s2s-read-timeout", { session = session });
 	end
 end