mod_csi_simple: Report whitespace keepalives
authorKim Alvefur <zash@zash.se>
Sun, 10 May 2020 23:09:15 +0200
changeset 10836 7395f6e68dba
parent 10835 7dd7cdb43181
child 10837 ac691f305ea7
mod_csi_simple: Report whitespace keepalives Single space character is sent by mod_c2s when a session has been silent for some time. This should account for the vast majority of raw strings passing through here. If this is not the case then having stats to say otherwise will be interesting.
plugins/mod_csi_simple.lua
--- a/plugins/mod_csi_simple.lua	Sun May 10 23:06:21 2020 +0200
+++ b/plugins/mod_csi_simple.lua	Sun May 10 23:09:15 2020 +0200
@@ -16,8 +16,9 @@
 local important_payloads = module:get_option_set("csi_important_payloads", { });
 
 function is_important(stanza) --> boolean, reason: string
-	if type(stanza) == "string" then
-		-- whitespace pings etc
+	if stanza == " " then
+		return true, "whitespace keepalive";
+	elseif type(stanza) == "string" then
 		return true, "raw data";
 	elseif not st.is_stanza(stanza) then
 		return true;