diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/relay/RelayMessageTransport.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/relay/RelayMessageTransport.kt index 73c09aed94..520f048b05 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/relay/RelayMessageTransport.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/relay/RelayMessageTransport.kt @@ -309,9 +309,11 @@ class RelayMessageTransport( override fun webSocketConnected(ws: ColibriWebSocket) { synchronized(webSocketSyncRoot) { // If we already have a web-socket, discard it and use the new one. - if (ws != webSocket && webSocket != null) { - logger.info("Replacing an existing websocket.") - webSocket?.session?.close(CloseStatus.NORMAL, "replaced") + if (ws != webSocket) { + if (webSocket != null) { + logger.info("Replacing an existing websocket.") + webSocket?.session?.close(CloseStatus.NORMAL, "replaced") + } webSocketLastActive = true webSocket = ws sendMessage(ws, createServerHello())