# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1589144955 -7200
# Node ID 7395f6e68dba448fba66cc245336af002d55db17
# Parent  7dd7cdb431817a26ab1e7800a8a089efdab86a38
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.

diff -r 7dd7cdb43181 -r 7395f6e68dba 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;