Changed 'timeoutAfter' from Int to Double to allow more precise value
This commit is contained in:
parent
b86e78797e
commit
38dea9bb3e
@ -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
|
/// - parameter timeoutAfter: The number of seconds after which if we are not connected we assume the connection
|
||||||
/// has failed. Pass 0 to never timeout.
|
/// has failed. Pass 0 to never timeout.
|
||||||
/// - parameter withHandler: The handler to call when the client fails to connect.
|
/// - 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)")
|
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
|
||||||
|
|
||||||
guard status != .connected else {
|
guard status != .connected else {
|
||||||
@ -187,7 +187,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
|||||||
|
|
||||||
guard timeoutAfter != 0 else { return }
|
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 }
|
guard let this = self, this.status == .connecting || this.status == .notConnected else { return }
|
||||||
|
|
||||||
this.status = .disconnected
|
this.status = .disconnected
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user