diff --git a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppProvider.kt b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppProvider.kt index db0df98ded..377ed6a1a7 100644 --- a/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppProvider.kt +++ b/jicofo-common/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppProvider.kt @@ -34,7 +34,6 @@ import org.jivesoftware.smack.ConnectionConfiguration import org.jivesoftware.smack.ConnectionListener import org.jivesoftware.smack.ReconnectionListener import org.jivesoftware.smack.ReconnectionManager -import org.jivesoftware.smack.SASLAuthentication import org.jivesoftware.smack.SmackException import org.jivesoftware.smack.XMPPConnection import org.jivesoftware.smack.tcp.XMPPTCPConnection @@ -287,21 +286,6 @@ class XmppProvider(val config: XmppConnectionConfig, parentLogger: Logger) { this.components = components } - companion object { - init { - EntityCapsManager.setDefaultEntityNode("http://jitsi.org/jicofo") - ReconnectionManager.setEnabledPerDefault(true) - // Jicofo handles at most two connections and most of the time that is localhost and the number - // of jicofo instances is small so we can afford to retry quickly. - ReconnectionManager.setDefaultFixedDelay(2) - // Smack uses SASL Mechanisms ANONYMOUS and PLAIN, but tries to authenticate with GSSAPI when it's offered - // by the server. Disable GSSAPI. - SASLAuthentication.unregisterSASLMechanism("org.jivesoftware.smack.sasl.javax.SASLGSSAPIMechanism") - XMPPTCPConnection.setUseStreamManagementResumptionDefault(true) - XMPPTCPConnection.setUseStreamManagementDefault(true) - } - } - class RoomExistsException(message: String) : Exception(message) interface Listener { fun registrationChanged(registered: Boolean) { } diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/Smack.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/Smack.kt index 90eec11773..b3dc38a79c 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/Smack.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/Smack.kt @@ -49,14 +49,34 @@ import org.jitsi.xmpp.extensions.jitsimeet.TranscriptionStatusExtension import org.jitsi.xmpp.extensions.jitsimeet.UserInfoPacketExt import org.jitsi.xmpp.extensions.jitsimeet.VideoMutedExtension import org.jitsi.xmpp.extensions.rayo.RayoIqProvider +import org.jivesoftware.smack.ReconnectionManager +import org.jivesoftware.smack.SASLAuthentication import org.jivesoftware.smack.SmackConfiguration import org.jivesoftware.smack.provider.ProviderManager +import org.jivesoftware.smack.tcp.XMPPTCPConnection +import org.jivesoftware.smackx.caps.EntityCapsManager fun initializeSmack() { - org.jitsi.xmpp.Smack.initialize(XmppConfig.config.useJitsiJidValidation) + org.jitsi.xmpp.Smack.initialize(useJitsiXmppStringprep = XmppConfig.config.useJitsiJidValidation) + EntityCapsManager.setDefaultEntityNode("http://jitsi.org/jicofo") + + // Default to 15 seconds, may be overriden by the different connections. SmackConfiguration.setDefaultReplyTimeout(15000) + ReconnectionManager.setEnabledPerDefault(true) + // Jicofo handles at most two connections and most of the time that is localhost and the number + // of jicofo instances is small so we can afford to retry quickly. + ReconnectionManager.setDefaultFixedDelay(2) + + // Smack uses SASL Mechanisms ANONYMOUS and PLAIN, but tries to authenticate with GSSAPI when it's offered + // by the server. Disable GSSAPI. + SASLAuthentication.unregisterSASLMechanism("org.jivesoftware.smack.sasl.javax.SASLGSSAPIMechanism") + + // Enable Stream Management + XMPPTCPConnection.setUseStreamManagementResumptionDefault(true) + XMPPTCPConnection.setUseStreamManagementDefault(true) + registerXmppExtensions() }