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)
|
postSendClose(nil, nil, nil)
|
||||||
} else {
|
} else {
|
||||||
// We need to take special care when we're polling that we send it ASAP
|
// We need to take special care when we're polling that we send it ASAP
|
||||||
postWait.append(String(SocketEnginePacketType.Close.rawValue))
|
// Also make sure we're on the emitQueue since we're touching postWait
|
||||||
let req = createRequestForPostWithPostWait()
|
dispatch_sync(emitQueue) {
|
||||||
doRequest(req, withCallback: postSendClose)
|
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) {
|
func didDisconnect(reason: String) {
|
||||||
guard status != .Closed else {
|
guard status != .Closed else { return }
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultSocketLogger.Logger.log("Disconnected: %@", type: logType, args: reason)
|
DefaultSocketLogger.Logger.log("Disconnected: %@", type: logType, args: reason)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user