comparison plugins/mod_s2s_bidi.lua @ 13509:f14066ee3239

mod_s2s_bidi: Include empty list of labels in metrics Throws error attempting to append the nil label list to an array for host-scoped metrics.
author Kim Alvefur <zash@zash.se>
date Fri, 16 Aug 2024 18:39:46 +0200
parents 4fb6a3eb9c29
children
comparison
equal deleted inserted replaced
13508:eac86b5fb04b 13509:f14066ee3239
10 local xmlns_bidi_feature = "urn:xmpp:features:bidi" 10 local xmlns_bidi_feature = "urn:xmpp:features:bidi"
11 local xmlns_bidi = "urn:xmpp:bidi"; 11 local xmlns_bidi = "urn:xmpp:bidi";
12 12
13 local require_encryption = module:get_option_boolean("s2s_require_encryption", true); 13 local require_encryption = module:get_option_boolean("s2s_require_encryption", true);
14 14
15 local offers_sent = module:metric("counter", "offers_sent", "", "Bidirectional connection offers sent"); 15 local offers_sent = module:metric("counter", "offers_sent", "", "Bidirectional connection offers sent", {});
16 local offers_recv = module:metric("counter", "offers_recv", "", "Bidirectional connection offers received"); 16 local offers_recv = module:metric("counter", "offers_recv", "", "Bidirectional connection offers received", {});
17 local offers_taken = module:metric("counter", "offers_taken", "", "Bidirectional connection offers taken"); 17 local offers_taken = module:metric("counter", "offers_taken", "", "Bidirectional connection offers taken", {});
18 18
19 module:hook("s2s-stream-features", function(event) 19 module:hook("s2s-stream-features", function(event)
20 local origin, features = event.origin, event.features; 20 local origin, features = event.origin, event.features;
21 if origin.type == "s2sin_unauthed" and (not require_encryption or origin.secure) then 21 if origin.type == "s2sin_unauthed" and (not require_encryption or origin.secure) then
22 features:tag("bidi", { xmlns = xmlns_bidi_feature }):up(); 22 features:tag("bidi", { xmlns = xmlns_bidi_feature }):up();