Reconnect on failed ping and remove reconnect timer

I think this does it
This commit is contained in:
William Casarin
2023-05-07 12:00:37 -07:00
parent a4d4ad72e6
commit 9b99e00804
2 changed files with 6 additions and 7 deletions

View File

@@ -57,8 +57,13 @@ final class RelayConnection {
func ping() {
socket.ping { err in
if err != nil {
if err == nil {
self.last_pong = .now
} else {
print("pong failed, reconnecting \(self.url.id)")
self.isConnected = false
self.isConnecting = false
self.reconnect_with_backoff()
}
}
}