rename socketackmap, code style changes for #55
This commit is contained in:
parent
f38cf9ed3a
commit
8b05f922a6
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// SocketAckMap.swift
|
// SocketAckManager.swift
|
||||||
// SocketIO-Swift
|
// SocketIO-Swift
|
||||||
//
|
//
|
||||||
// Created by Erik Little on 4/3/15.
|
// Created by Erik Little on 4/3/15.
|
||||||
@ -49,7 +49,7 @@ private func ==(lhs:SocketAck, rhs:SocketAck) -> Bool {
|
|||||||
return lhs.ack == rhs.ack
|
return lhs.ack == rhs.ack
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SocketAckMap {
|
struct SocketAckManager {
|
||||||
private var acks = Set<SocketAck>(minimumCapacity: 1)
|
private var acks = Set<SocketAck>(minimumCapacity: 1)
|
||||||
|
|
||||||
mutating func addAck(ack:Int, callback:AckCallback) {
|
mutating func addAck(ack:Int, callback:AckCallback) {
|
||||||
4
SocketIOClientSwift/SocketEngine.swift
Executable file → Normal file
4
SocketIOClientSwift/SocketEngine.swift
Executable file → Normal file
@ -23,6 +23,7 @@
|
|||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
private var length:Int {
|
private var length:Int {
|
||||||
return count(self)
|
return count(self)
|
||||||
@ -92,7 +93,8 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public init(client:SocketEngineClient, forcePolling:Bool,
|
public init(client:SocketEngineClient, forcePolling:Bool,
|
||||||
forceWebsockets:Bool, withCookies cookies:[NSHTTPCookie]?, logging:Bool, withSessionDelegate sessionDelegate : NSURLSessionDelegate?) {
|
forceWebsockets:Bool, withCookies cookies:[NSHTTPCookie]?, logging:Bool,
|
||||||
|
withSessionDelegate sessionDelegate:NSURLSessionDelegate?) {
|
||||||
self.client = client
|
self.client = client
|
||||||
self.forcePolling = forcePolling
|
self.forcePolling = forcePolling
|
||||||
self.forceWebsockets = forceWebsockets
|
self.forceWebsockets = forceWebsockets
|
||||||
|
|||||||
7
SocketIOClientSwift/SocketIOClient.swift
Executable file → Normal file
7
SocketIOClientSwift/SocketIOClient.swift
Executable file → Normal file
@ -43,12 +43,11 @@ public final class SocketIOClient: NSObject, NSURLSessionDelegate, SocketEngineC
|
|||||||
|
|
||||||
let reconnectAttempts:Int!
|
let reconnectAttempts:Int!
|
||||||
let logType = "SocketClient"
|
let logType = "SocketClient"
|
||||||
var ackHandlers = SocketAckMap()
|
var ackHandlers = SocketAckManager()
|
||||||
var currentAck = -1
|
var currentAck = -1
|
||||||
var log = false
|
var log = false
|
||||||
var waitingData = ContiguousArray<SocketPacket>()
|
var waitingData = ContiguousArray<SocketPacket>()
|
||||||
|
var sessionDelegate:NSURLSessionDelegate?
|
||||||
var sessionDelegate : NSURLSessionDelegate?
|
|
||||||
|
|
||||||
public let socketURL:String
|
public let socketURL:String
|
||||||
public let handleAckQueue = dispatch_queue_create("handleAckQueue", DISPATCH_QUEUE_SERIAL)
|
public let handleAckQueue = dispatch_queue_create("handleAckQueue", DISPATCH_QUEUE_SERIAL)
|
||||||
@ -153,7 +152,7 @@ public final class SocketIOClient: NSObject, NSURLSessionDelegate, SocketEngineC
|
|||||||
forceWebsockets: self.forceWebsockets,
|
forceWebsockets: self.forceWebsockets,
|
||||||
withCookies: self.cookies,
|
withCookies: self.cookies,
|
||||||
logging: self.log,
|
logging: self.log,
|
||||||
withSessionDelegate : self.sessionDelegate)
|
withSessionDelegate: self.sessionDelegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user