Dispose tunnel if can't try next protocol
Return boolean in socketShouldChangeProtocol indicating whether another protocol is available.
This commit is contained in:
parent
de09d0b5da
commit
8adb9871c3
|
@ -44,7 +44,7 @@ protocol LinkProducer {
|
|||
protocol GenericSocketDelegate: class {
|
||||
func socketDidTimeout(_ socket: GenericSocket)
|
||||
|
||||
func socketShouldChangeProtocol(_ socket: GenericSocket)
|
||||
func socketShouldChangeProtocol(_ socket: GenericSocket) -> Bool
|
||||
|
||||
func socketDidBecomeActive(_ socket: GenericSocket)
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class NETCPSocket: NSObject, GenericSocket {
|
|||
return
|
||||
}
|
||||
guard _self.isActive else {
|
||||
_self.delegate?.socketShouldChangeProtocol(_self)
|
||||
_ = _self.delegate?.socketShouldChangeProtocol(_self)
|
||||
_self.delegate?.socketDidTimeout(_self)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -388,11 +388,12 @@ extension TunnelKitProvider: GenericSocketDelegate {
|
|||
socket.shutdown()
|
||||
}
|
||||
|
||||
func socketShouldChangeProtocol(_ socket: GenericSocket) {
|
||||
func socketShouldChangeProtocol(_ socket: GenericSocket) -> Bool {
|
||||
guard strategy.tryNextProtocol() else {
|
||||
disposeTunnel(error: ProviderError.exhaustedProtocols)
|
||||
return
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func socketDidBecomeActive(_ socket: GenericSocket) {
|
||||
|
|
Loading…
Reference in New Issue