From e2b6f4d033daa8e9cded28b0b72947b9c71e9af5 Mon Sep 17 00:00:00 2001 From: bgrozev Date: Thu, 5 Dec 2024 08:02:17 -0600 Subject: [PATCH] Enable XMPP stream resumption (#2257) * feat: Add a metric for XMPP disconnects. * chore: Update jicoco to 1.1-148 (enable XMPP SM) feat: Add an endpointId field to StartEvent. feat: Move jwt utils from jibri into jicoco-jwt. chore: Update jitsi-metaconfig. Add Java 21 to GitHub testing matrix feat: Enables stream resumption. --- .../jitsi/videobridge/metrics/VideobridgeMetrics.kt | 5 +++++ .../org/jitsi/videobridge/xmpp/XmppConnection.kt | 10 ++++++++++ pom.xml | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/metrics/VideobridgeMetrics.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/metrics/VideobridgeMetrics.kt index 6012b1873f..582c163c9e 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/metrics/VideobridgeMetrics.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/metrics/VideobridgeMetrics.kt @@ -247,6 +247,11 @@ object VideobridgeMetrics { "Total duration of video received, in milliseconds (each SSRC counts separately)." ) + val xmppDisconnects = metricsContainer.registerCounter( + "xmpp_disconnects", + "The number of times one of the XMPP connections has disconnected." + ) + private val tossedPacketsEnergyBuckets = listOf(0, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127).map { it.toDouble() } .toDoubleArray() diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/xmpp/XmppConnection.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/xmpp/XmppConnection.kt index bfe91f869f..37530e0f34 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/xmpp/XmppConnection.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/xmpp/XmppConnection.kt @@ -20,12 +20,14 @@ import org.jitsi.nlj.stats.DelayStats import org.jitsi.utils.OrderedJsonObject import org.jitsi.utils.logging2.cdebug import org.jitsi.utils.logging2.createLogger +import org.jitsi.videobridge.metrics.VideobridgeMetrics import org.jitsi.videobridge.metrics.VideobridgeMetricsContainer import org.jitsi.videobridge.xmpp.config.XmppClientConnectionConfig.Companion.config import org.jitsi.xmpp.extensions.colibri.ForcefulShutdownIQ import org.jitsi.xmpp.extensions.colibri.GracefulShutdownIQ import org.jitsi.xmpp.extensions.colibri2.ConferenceModifyIQ import org.jitsi.xmpp.extensions.health.HealthCheckIQ +import org.jitsi.xmpp.mucclient.ConnectionStateListener import org.jitsi.xmpp.mucclient.IQListener import org.jitsi.xmpp.mucclient.MucClient import org.jitsi.xmpp.mucclient.MucClientConfiguration @@ -64,6 +66,14 @@ class XmppConnection : IQListener { registerIQ(GracefulShutdownIQ()) registerIQ(ConferenceModifyIQ.ELEMENT, ConferenceModifyIQ.NAMESPACE, false) setIQListener(this@XmppConnection) + addConnectionStateListener(object : ConnectionStateListener { + override fun connected(mucClient: MucClient) {} + override fun closed(mucClient: MucClient) = VideobridgeMetrics.xmppDisconnects.inc() + override fun closedOnError(mucClient: MucClient) = VideobridgeMetrics.xmppDisconnects.inc() + override fun reconnecting(mucClient: MucClient) {} + override fun reconnectionFailed(mucClient: MucClient) {} + override fun pingFailed(mucClient: MucClient) {} + }) } config.clientConfigs.forEach { cfg -> mucClientManager.addMucClient(cfg) } diff --git a/pom.xml b/pom.xml index 96df738c07..67676da56f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ 5.9.1 5.10.2 1.0-133-g6af1020 - 1.1-143-g175c44b + 1.1-148-g3afa2ac 1.13.11 3.2.0 3.6.0