Skip to content

Commit dee508c

Browse files
committed
fix race condition
1 parent 4de422e commit dee508c

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

SwiftIO/SocketEngineClient.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import Foundation
2727

2828
@objc public protocol SocketEngineClient {
29-
var ackQueue:dispatch_queue_attr_t! {get}
3029
var handleQueue:dispatch_queue_attr_t! {get}
3130
var emitQueue:dispatch_queue_attr_t! {get}
3231
var reconnecting:Bool {get}
@@ -38,4 +37,4 @@ import Foundation
3837
func pollingDidFail(err:NSError)
3938
func webSocketDidCloseWithCode(code:Int, reason:String, wasClean:Bool)
4039
func webSocketDidFailWithError(error:NSError)
41-
}
40+
}

SwiftIO/SocketIOClient.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public class SocketIOClient: NSObject, SocketEngineClient {
4545
var waitingData = ContiguousArray<SocketPacket>()
4646

4747
public let socketURL:String
48-
public let ackQueue = dispatch_queue_create("ackQueue".cStringUsingEncoding(NSUTF8StringEncoding),
49-
DISPATCH_QUEUE_SERIAL)
5048
public let handleQueue = dispatch_queue_create("handleQueue".cStringUsingEncoding(NSUTF8StringEncoding),
5149
DISPATCH_QUEUE_SERIAL)
5250
public let emitQueue = dispatch_queue_create("emitQueue".cStringUsingEncoding(NSUTF8StringEncoding),
@@ -263,7 +261,7 @@ public class SocketIOClient: NSObject, SocketEngineClient {
263261

264262
// If the server wants to know that the client received data
265263
func emitAck(ack:Int, withData args:[AnyObject]?) {
266-
dispatch_async(self.ackQueue) {[weak self] in
264+
dispatch_async(self.emitQueue) {[weak self] in
267265
if self == nil || !self!.connected || args == nil {
268266
return
269267
}

0 commit comments

Comments
 (0)