diff --git a/TunnelKit/Sources/AppExtension/TunnelKitProvider.swift b/TunnelKit/Sources/AppExtension/TunnelKitProvider.swift index 07cba96..b47e1aa 100644 --- a/TunnelKit/Sources/AppExtension/TunnelKitProvider.swift +++ b/TunnelKit/Sources/AppExtension/TunnelKitProvider.swift @@ -403,6 +403,12 @@ extension TunnelKitProvider: GenericSocketDelegate { if reasserting { log.debug("Disconnection is recoverable, tunnel will reconnect in \(reconnectionDelay) milliseconds...") tunnelQueue.schedule(after: .milliseconds(reconnectionDelay)) { + + // give up if reasserting cleared in the meantime + guard self.reasserting else { + return + } + self.connectTunnel(upgradedSocket: upgradedSocket, preferredAddress: socket.remoteAddress) } return