Only try upgrade socket on network error
This commit is contained in:
parent
11419ed28a
commit
de09d0b5da
|
@ -412,9 +412,6 @@ extension TunnelKitProvider: GenericSocketDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
// upgrade available?
|
||||
let upgradedSocket = socket.upgraded()
|
||||
|
||||
var shutdownError: Error?
|
||||
if !failure {
|
||||
shutdownError = proxy.stopError
|
||||
|
@ -424,6 +421,12 @@ extension TunnelKitProvider: GenericSocketDelegate {
|
|||
log.debug("Link failures so far: \(linkFailures) (max = \(maxLinkFailures))")
|
||||
}
|
||||
|
||||
// only try upgrade on network errors
|
||||
var upgradedSocket: GenericSocket? = nil
|
||||
if shutdownError as? SessionError == nil {
|
||||
upgradedSocket = socket.upgraded()
|
||||
}
|
||||
|
||||
// treat negotiation timeout as socket timeout, UDP is connection-less
|
||||
if proxy.stopError as? SessionError == SessionError.negotiationTimeout {
|
||||
socketShouldChangeProtocol(socket)
|
||||
|
|
Loading…
Reference in New Issue