fix possible race condition
This commit is contained in:
parent
750ba138e1
commit
0f70079382
@ -202,9 +202,12 @@ public final class SocketEngine: NSObject, SocketEnginePollable, SocketEngineWeb
|
||||
postSendClose(nil, nil, nil)
|
||||
} else {
|
||||
// We need to take special care when we're polling that we send it ASAP
|
||||
postWait.append(String(SocketEnginePacketType.Close.rawValue))
|
||||
let req = createRequestForPostWithPostWait()
|
||||
doRequest(req, withCallback: postSendClose)
|
||||
// Also make sure we're on the emitQueue since we're touching postWait
|
||||
dispatch_sync(emitQueue) {
|
||||
self.postWait.append(String(SocketEnginePacketType.Close.rawValue))
|
||||
let req = self.createRequestForPostWithPostWait()
|
||||
self.doRequest(req, withCallback: postSendClose)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -214,9 +214,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
|
||||
}
|
||||
|
||||
func didDisconnect(reason: String) {
|
||||
guard status != .Closed else {
|
||||
return
|
||||
}
|
||||
guard status != .Closed else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Disconnected: %@", type: logType, args: reason)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user