From a98a33cfe19a5998b1ef760554be89ddd1b182ff Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Thu, 10 Dec 2020 11:53:10 +0100
Subject: mod_s2s: Prevent whitespace keepalives the stream has been opened

This will result in the stream timing out instead, which is probably
correct if the stream has not been opened yet.

This was already done for c2s in e69df8093387

Thanks Ge0rG
---
 plugins/mod_s2s/mod_s2s.lua | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'plugins')

diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index 5439aa96..4fce20eb 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -163,7 +163,10 @@ function route_to_new_session(event)
 end
 
 local function keepalive(event)
-	return event.session.sends2s(' ');
+	local session = event.session;
+	if not session.notopen then
+		return event.session.send(' ');
+	end
 end
 
 module:hook("s2s-read-timeout", keepalive, -1);
-- 
cgit v1.2.3