fix race condition
This commit is contained in:
parent
72d5c07de1
commit
cbc59d6004
@ -557,16 +557,22 @@ public class SocketEngine: NSObject, WebSocketDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func write(msg:String, withType type:PacketType, withData data:[NSData]?) {
|
public func write(msg:String, withType type:PacketType, withData data:[NSData]?) {
|
||||||
if !self.connected {
|
dispatch_async(self.emitQueue) {[weak self] in
|
||||||
return
|
if self == nil {
|
||||||
}
|
return
|
||||||
|
}
|
||||||
if self.websocket {
|
|
||||||
// NSLog("writing ws: \(msg):\(datas)")
|
if !self!.connected {
|
||||||
self.sendWebSocketMessage(msg, withType: type, datas: data)
|
return
|
||||||
} else {
|
}
|
||||||
// NSLog("writing poll: \(msg):\(datas)")
|
|
||||||
self.sendPollMessage(msg, withType: type, datas: data)
|
if self!.websocket {
|
||||||
|
// NSLog("writing ws: \(msg):\(datas)")
|
||||||
|
self?.sendWebSocketMessage(msg, withType: type, datas: data)
|
||||||
|
} else {
|
||||||
|
// NSLog("writing poll: \(msg):\(datas)")
|
||||||
|
self?.sendPollMessage(msg, withType: type, datas: data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user