Skip to content

Commit

Permalink
at the risk of duplicate state notifications, adding in a few spots o…
Browse files Browse the repository at this point in the history
…f disconnect that happens during read errors or exception handling (#94)
  • Loading branch information
heckj authored May 14, 2024
1 parent cf9fdd5 commit 9ccb152
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ public final class WebSocketProvider: NetworkProvider {
} catch {
// error scenario with the WebSocket connection
Logger.websocket.warning("WEBSOCKET: Error reading websocket: \(error.localizedDescription)")
statePublisher.send(.disconnected)
peered = false
msgFromWebSocket = nil
}
Expand All @@ -443,6 +444,7 @@ public final class WebSocketProvider: NetworkProvider {
self.peered = false
webSocketTask?.cancel()
webSocketTask = nil
statePublisher.send(.disconnected)
Logger.websocket.warning("WEBSOCKET: receive and reconnect loop terminated")
}

Expand Down

0 comments on commit 9ccb152

Please # to comment.