From 725d86844eb402cf085838d0be347b3e45a7c5e8 Mon Sep 17 00:00:00 2001 From: pun4drunk Date: Mon, 27 Jul 2020 17:25:46 +0300 Subject: [PATCH] prevent duplicate connect --- Sources/Transport/TCPTransport.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Transport/TCPTransport.swift b/Sources/Transport/TCPTransport.swift index 459cb2ed..7af0bf7e 100644 --- a/Sources/Transport/TCPTransport.swift +++ b/Sources/Transport/TCPTransport.swift @@ -50,6 +50,9 @@ public class TCPTransport: Transport { } public func connect(url: URL, timeout: Double = 10, certificatePinning: CertificatePinning? = nil) { + if connection != nil { + return + } guard let parts = url.getParts() else { delegate?.connectionChanged(state: .failed(TCPTransportError.invalidRequest)) return