Changeset

7466:f28fa742def3

mod_c2s, mod_s2s: Bootstrap connection count statistic on module load
author Kim Alvefur <zash@zash.se>
date Thu, 07 Jul 2016 18:48:58 +0200
parents 7464:3b7de72e58a9
children 7467:9a73c85baffe 7468:2d38a2519d09
files plugins/mod_c2s.lua plugins/mod_s2s/mod_s2s.lua
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Thu Jul 07 23:08:47 2016 +0100
+++ b/plugins/mod_c2s.lua	Thu Jul 07 18:48:58 2016 +0200
@@ -36,6 +36,16 @@
 local stream_callbacks = { default_ns = "jabber:client" };
 local listener = {};
 
+do
+	-- Connection counter resets to 0 on load and reload
+	-- Bump it up to current value
+	local count = 0;
+	for _ in pairs(sessions) do
+		count = count + 1;
+	end
+	measure_connections(count);
+end
+
 --- Stream events handlers
 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
 
--- a/plugins/mod_s2s/mod_s2s.lua	Thu Jul 07 23:08:47 2016 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Thu Jul 07 18:48:58 2016 +0200
@@ -43,6 +43,16 @@
 
 local log = module._log;
 
+do
+	-- Connection counter resets to 0 on load and reload
+	-- Bump it up to current value
+	local count = 0;
+	for _ in pairs(sessions) do
+		count = count + 1;
+	end
+	measure_connections(count);
+end
+
 --- Handle stanzas to remote domains
 
 local bouncy_stanzas = { message = true, presence = true, iq = true };