commit 8c55f23ea8a7a878b3682a1d0cf8dca5d6d18a96
parent b43aca8abb310c6ee94968cf56bac91ad8d2f787
Author: William Casarin <jb55@jb55.com>
Date: Sun, 7 May 2023 11:17:14 -0700
Don't put reconnect logic in ping
It seems to be very bad
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/damus/Nostr/RelayConnection.swift b/damus/Nostr/RelayConnection.swift
@@ -57,11 +57,7 @@ final class RelayConnection {
func ping() {
socket.ping { err in
- if let err {
- self.isConnecting = false
- self.isConnected = false
- self.reconnect_with_backoff()
- } else {
+ if err != nil {
self.last_pong = .now
}
}
@@ -124,7 +120,7 @@ final class RelayConnection {
DispatchQueue.main.async {
self.isConnected = false
self.isConnecting = false
- self.reconnect_with_backoff()
+ self.reconnect()
}
case .error(let error):
print("⚠️ Warning: RelayConnection (\(self.url)) error: \(error)")