# HG changeset patch # User Kim Alvefur # Date 1467910138 -7200 # Node ID f28fa742def3412be247f5e70e919bb8c276562e # Parent 3b7de72e58a9d3b27c8ac9f8aae84bec15273d7a mod_c2s, mod_s2s: Bootstrap connection count statistic on module load diff -r 3b7de72e58a9 -r f28fa742def3 plugins/mod_c2s.lua --- 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'}; diff -r 3b7de72e58a9 -r f28fa742def3 plugins/mod_s2s/mod_s2s.lua --- 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 };