Commit 3c13daf7 authored by Dapperstout's avatar Dapperstout

Use GCDAsyncSocket's synchronous methods to set delegate and delegate queue.

parent ba9781fb
......@@ -9,8 +9,8 @@ public class Connector : NSObject {
}
public func connect(host: NSString, port: UInt16, deviceId: String, onCompletion: (Connection?) -> () = {(connection: Connection?) in }) {
socket.setDelegateQueue(queue)
socket.synchronouslySetDelegate(self) // TODO: don't actually need delegate here, but without it, connectToHost doesn't work...
socket.synchronouslySetDelegateQueue(queue)
socket.synchronouslySetDelegate(self) // don't actually need delegate here, but without it, connectToHost doesn't work...
if socket.connectToHost(host, onPort: port, error: nil) {
secure(socket, deviceId: deviceId, onCompletion)
} else {
......
......@@ -45,7 +45,7 @@ class TLSNegotiation: NSObject, GCDAsyncSocketDelegate {
}
func start() {
socket.setDelegate(self)
socket.synchronouslySetDelegate(self)
socket.startTLS([
GCDAsyncSocketSSLProtocolVersionMin: NSNumber(unsignedInt: kTLSProtocol12.value),
GCDAsyncSocketSSLCipherSuites: acceptableCipherSuites,
......
......@@ -15,11 +15,11 @@ class SocketSpy: GCDAsyncSocket {
var latestDelegate: GCDAsyncSocketDelegate?
var latestDelegateQueue: dispatch_queue_t?
override func setDelegate(delegate: AnyObject?) {
override func synchronouslySetDelegate(delegate: AnyObject?) {
latestDelegate = delegate as? GCDAsyncSocketDelegate
}
override func setDelegateQueue(queue: dispatch_queue_t) {
override func synchronouslySetDelegateQueue(queue: dispatch_queue_t) {
latestDelegateQueue = queue
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment