Merge pull request #719 from mathieurobidoux/master
Changed 'timeoutAfter' from Int to Double to allow more precise value
This commit is contained in:
commit
d09c2f046b
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user