Fix swift3 errors that happened during merge
This commit is contained in:
parent
bd192b9af5
commit
f5cf2b8de5
@ -359,7 +359,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
|||||||
do {
|
do {
|
||||||
let json = try openData.toNSDictionary()
|
let json = try openData.toNSDictionary()
|
||||||
guard let sid = json["sid"] as? String else {
|
guard let sid = json["sid"] as? String else {
|
||||||
client?.engineDidError("Open packet contained no sid")
|
client?.engineDidError(reason: "Open packet contained no sid")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
|||||||
upgradeWs = false
|
upgradeWs = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if let pingInterval = json["pingInterval"] as? Double, pingTimeout = json["pingTimeout"] as? Double {
|
if let pingInterval = json["pingInterval"] as? Double, let pingTimeout = json["pingTimeout"] as? Double {
|
||||||
self.pingInterval = pingInterval / 1000.0
|
self.pingInterval = pingInterval / 1000.0
|
||||||
self.pingTimeout = pingTimeout / 1000.0
|
self.pingTimeout = pingTimeout / 1000.0
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
|||||||
doPoll()
|
doPoll()
|
||||||
}
|
}
|
||||||
|
|
||||||
client?.engineDidOpen("Connect")
|
client?.engineDidOpen(reason: "Connect")
|
||||||
} catch {
|
} catch {
|
||||||
didError(reason: "Error parsing open packet")
|
didError(reason: "Error parsing open packet")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
|||||||
let time = DispatchTime.now() + Double(Int64(timeoutAfter) * Int64(NSEC_PER_SEC)) / Double(NSEC_PER_SEC)
|
let time = DispatchTime.now() + Double(Int64(timeoutAfter) * Int64(NSEC_PER_SEC)) / Double(NSEC_PER_SEC)
|
||||||
|
|
||||||
handleQueue.asyncAfter(deadline: time) {[weak self] in
|
handleQueue.asyncAfter(deadline: time) {[weak self] in
|
||||||
guard let this = self where this.status != .Connected && this.status != .Disconnected else { return }
|
guard let this = self, this.status != .connected && this.status != .disconnected else { return }
|
||||||
|
|
||||||
this.status = .disconnected
|
this.status = .disconnected
|
||||||
this.engine?.disconnect(reason: "Connect timeout")
|
this.engine?.disconnect(reason: "Connect timeout")
|
||||||
|
|||||||
@ -32,7 +32,7 @@ extension SocketParsable {
|
|||||||
return nsp == self.nsp
|
return nsp == self.nsp
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleConnect(packetNamespace: String) {
|
private func handleConnect(_ packetNamespace: String) {
|
||||||
if packetNamespace == "/" && nsp != "/" {
|
if packetNamespace == "/" && nsp != "/" {
|
||||||
joinNamespace(nsp)
|
joinNamespace(nsp)
|
||||||
} else {
|
} else {
|
||||||
@ -53,7 +53,7 @@ extension SocketParsable {
|
|||||||
case .connect:
|
case .connect:
|
||||||
handleConnect(pack.nsp)
|
handleConnect(pack.nsp)
|
||||||
case .disconnect:
|
case .disconnect:
|
||||||
didDisconnect("Got Disconnect")
|
didDisconnect(reason: "Got Disconnect")
|
||||||
case .error:
|
case .error:
|
||||||
handleEvent("error", data: pack.data, isInternalMessage: true, withAck: pack.id)
|
handleEvent("error", data: pack.data, isInternalMessage: true, withAck: pack.id)
|
||||||
default:
|
default:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user