aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_s2s_bidi.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_s2s_bidi.lua')
-rw-r--r--plugins/mod_s2s_bidi.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_s2s_bidi.lua b/plugins/mod_s2s_bidi.lua
index 22415293..8588ce59 100644
--- a/plugins/mod_s2s_bidi.lua
+++ b/plugins/mod_s2s_bidi.lua
@@ -12,10 +12,15 @@ local xmlns_bidi = "urn:xmpp:bidi";
local require_encryption = module:get_option_boolean("s2s_require_encryption", true);
+local offers_sent = module:metric("counter", "offers_sent", "", "Bidirectional connection offers sent", {});
+local offers_recv = module:metric("counter", "offers_recv", "", "Bidirectional connection offers received", {});
+local offers_taken = module:metric("counter", "offers_taken", "", "Bidirectional connection offers taken", {});
+
module:hook("s2s-stream-features", function(event)
local origin, features = event.origin, event.features;
if origin.type == "s2sin_unauthed" and (not require_encryption or origin.secure) then
features:tag("bidi", { xmlns = xmlns_bidi_feature }):up();
+ offers_sent:with_labels():add(1);
end
end);
@@ -28,6 +33,7 @@ module:hook_tag("http://etherx.jabber.org/streams", "features", function (sessio
local request_bidi = st.stanza("bidi", { xmlns = xmlns_bidi });
module:fire_event("s2sout-stream-features", { origin = session, features = request_bidi });
session.sends2s(request_bidi);
+ offers_taken:with_labels():add(1);
end
end
end, 200);
@@ -36,6 +42,7 @@ module:hook_tag("urn:xmpp:bidi", "bidi", function(session)
if session.type == "s2sin_unauthed" and (not require_encryption or session.secure) then
session.log("debug", "Requested bidirectional stream");
session.outgoing = true;
+ offers_recv:with_labels():add(1);
return true;
end
end);