From 3e6cbfe1900759cdab7481baf3b9cb7b3bba9047 Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Fri, 15 Mar 2024 09:58:54 +0000 Subject: [PATCH] make sure tzktclient correctly logs that the socket is not listening during errors --- Sources/KukaiCoreSwift/Clients/TzKTClient.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/KukaiCoreSwift/Clients/TzKTClient.swift b/Sources/KukaiCoreSwift/Clients/TzKTClient.swift index d6206a2b..fae24143 100644 --- a/Sources/KukaiCoreSwift/Clients/TzKTClient.swift +++ b/Sources/KukaiCoreSwift/Clients/TzKTClient.swift @@ -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 @@ -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) @@ -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 } }