From 38dea9bb3ee6fc22978ca7c337e43284c8d8579f Mon Sep 17 00:00:00 2001 From: mathieurobidoux Date: Sun, 25 Jun 2017 13:13:32 -0400 Subject: [PATCH] Changed 'timeoutAfter' from Int to Double to allow more precise value --- Source/SocketIOClient.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/SocketIOClient.swift b/Source/SocketIOClient.swift index 1a43b54..d2b4b3a 100644 --- a/Source/SocketIOClient.swift +++ b/Source/SocketIOClient.swift @@ -169,7 +169,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So /// - parameter timeoutAfter: The number of seconds after which if we are not connected we assume the connection /// has failed. Pass 0 to never timeout. /// - parameter withHandler: The handler to call when the client fails to connect. - open func connect(timeoutAfter: Int, withHandler handler: (() -> ())?) { + open func connect(timeoutAfter: Double, withHandler handler: (() -> ())?) { assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)") guard status != .connected else { @@ -187,7 +187,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So guard timeoutAfter != 0 else { return } - handleQueue.asyncAfter(deadline: DispatchTime.now() + Double(timeoutAfter)) {[weak self] in + handleQueue.asyncAfter(deadline: DispatchTime.now() + timeoutAfter) {[weak self] in guard let this = self, this.status == .connecting || this.status == .notConnected else { return } this.status = .disconnected