Skip to content

Commit

Permalink
make sure tzktclient correctly logs that the socket is not listening …
Browse files Browse the repository at this point in the history
…during errors
  • Loading branch information
simonmcl committed Mar 15, 2024
1 parent c6d83f5 commit 3e6cbfe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/KukaiCoreSwift/Clients/TzKTClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ public class TzKTClient {
Logger.tzkt.error("Failed to parse incoming websocket data: \(error)")
self?.signalrConnection?.stop()
self?.isListening = false
//completion(false, error, KukaiError.internalApplicationError(error: error))
}
})
signalrConnection?.delegate = self
Expand Down Expand Up @@ -1098,14 +1097,17 @@ extension TzKTClient: HubConnectionDelegate {
if let error = error {
Logger.tzkt.error("Subscribe to account changes failed: \(error)")
self?.signalrConnection?.stop()
self?.isListening = false
} else {
Logger.tzkt.info("Subscribe to account changes succeeded, waiting for objects")
self?.isListening = true
}
}
}

public func connectionDidClose(error: Error?) {
Logger.tzkt.error("SignalR connection closed: \(error)")
isListening = false

if newAddressesToWatch.count > 0 {
self.listenForAccountChanges(addresses: newAddressesToWatch)
Expand All @@ -1115,5 +1117,6 @@ extension TzKTClient: HubConnectionDelegate {

public func connectionDidFailToOpen(error: Error) {
Logger.tzkt.error("Failed to open SignalR connection to listen for changes: \(error)")
isListening = false
}
}

0 comments on commit 3e6cbfe

Please sign in to comment.