Skip to content

Commit

Permalink
fix: Fix saving the connected WebSocket instance the first time. (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored Nov 6, 2023
1 parent 7a4dc8b commit 5c48e42
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 5c48e42

Please sign in to comment.