Skip to content

Commit

Permalink
break terminating retry loop incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
heckj committed May 10, 2024
1 parent a95edc7 commit 7c0912f
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,21 +404,16 @@ public final class WebSocketProvider: NetworkProvider {
}
}

guard let webSocketTask else {
Logger.websocket.warning("WEBSOCKET: Receive Handler: webSocketTask is nil, terminating handler loop")
break // terminates the while loop - no more reconnect attempts
}

// co-operative cancellation
if Task.isCancelled {
webSocketTask.cancel()
webSocketTask?.cancel()
peered = false
tryToReconnect = false
break
}

do {
msgFromWebSocket = try await webSocketTask.receive()
msgFromWebSocket = try await webSocketTask?.receive()
} catch {
// error scenario with the WebSocket connection
Logger.websocket.warning("WEBSOCKET: Error reading websocket: \(error.localizedDescription)")
Expand Down

0 comments on commit 7c0912f

Please sign in to comment.