refactor some reconnect code
This commit is contained in:
parent
b6cb0b2c7b
commit
14b4df3836
@ -413,18 +413,16 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func tryReconnectWithReason(reason: String) {
|
private func tryReconnectWithReason(reason: String) {
|
||||||
if reconnecting {
|
guard reconnecting else { return }
|
||||||
DefaultSocketLogger.Logger.log("Starting reconnect", type: logType)
|
|
||||||
handleEvent("reconnect", data: [reason], isInternalMessage: true)
|
|
||||||
|
|
||||||
_tryReconnect()
|
DefaultSocketLogger.Logger.log("Starting reconnect", type: logType)
|
||||||
}
|
handleEvent("reconnect", data: [reason], isInternalMessage: true)
|
||||||
|
|
||||||
|
_tryReconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func _tryReconnect() {
|
private func _tryReconnect() {
|
||||||
if !reconnecting {
|
guard reconnecting else { return }
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects {
|
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects {
|
||||||
return didDisconnect("Reconnect Failed")
|
return didDisconnect("Reconnect Failed")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user