merge development

This commit is contained in:
Erik 2016-07-29 20:06:43 -04:00
commit a5db13c8b5
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
4 changed files with 31 additions and 19 deletions

View File

@ -90,21 +90,21 @@ Carthage
-----------------
Add this line to your `Cartfile`:
```
github "socketio/socket.io-client-swift" ~> 6.1.5 # Or latest version
github "socketio/socket.io-client-swift" ~> 6.1.6 # Or latest version
```
Run `carthage update --platform ios,macosx`.
CocoaPods 0.36.0 or later (iOS 8+)
CocoaPods 1.0.0 or later
------------------
Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Socket.IO-Client-Swift', '~> 6.1.5' # Or latest version
target 'YourApp' do
pod 'Socket.IO-Client-Swift', '~> 6.1.6' # Or latest version
end
```
Install pods:
@ -123,7 +123,7 @@ import SocketIOClientSwift
Objective-C:
```Objective-C
#import <SocketIOClientSwift/SocketIOClientSwift-Swift.h>
@import SocketIOClientSwift;
```
CocoaSeeds
@ -132,7 +132,7 @@ CocoaSeeds
Add this line to your `Seedfile`:
```
github "socketio/socket.io-client-swift", "v6.1.5", :files => "Source/*.swift" # Or latest version
github "socketio/socket.io-client-swift", "v6.1.6", :files => "Source/*.swift" # Or latest version
```
Run `seed install`.

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIOClientSwift"
s.version = "6.1.5"
s.version = "6.1.6"
s.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC
Socket.IO-client for iOS and OS X.
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0'
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.5' }
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.6' }
s.source_files = "Source/**/*.swift"
s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

View File

@ -54,8 +54,8 @@ public class SSLSecurity : NSObject {
public var validatedDN = true //should the domain name be validated?
var isReady = false //is the key processing done?
var certificates: [Data]? //the certificates
var pubKeys: [SecKey]? //the public keys
var certificates: [NSData]? //the certificates
@nonobjc var pubKeys: [SecKey]? //the public keys
var usePublicKeys = false //use public keys or certificate validation?
/**
@ -148,7 +148,7 @@ public class SSLSecurity : NSObject {
SecTrustSetPolicies(trust,policy)
if self.usePublicKeys {
if let keys = self.pubKeys {
let serverPubKeys = publicKeyChainForTrust(trust)
let serverPubKeys = publicKeyChainForTrust(trust: trust)
for serverKey in serverPubKeys as [AnyObject] {
for key in keys as [AnyObject] {
if serverKey.isEqual(key) {
@ -241,7 +241,7 @@ public class SSLSecurity : NSObject {
- returns: the public keys from the certifcate chain for the trust
*/
func publicKeyChainForTrust(_ trust: SecTrust) -> [SecKey] {
@nonobjc func publicKeyChainForTrust(trust: SecTrust) -> [SecKey] {
let policy = SecPolicyCreateBasicX509()
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKey]()) { (keys: [SecKey], index: Int) -> [SecKey] in
var keys = keys

View File

@ -24,7 +24,7 @@
import Foundation
public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWebsocket {
public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket {
public let emitQueue = DispatchQueue(label: "com.socketio.engineEmitQueue", attributes: DispatchQueueAttributes.serial)
public let handleQueue = DispatchQueue(label: "com.socketio.engineHandleQueue", attributes: DispatchQueueAttributes.serial)
public let parseQueue = DispatchQueue(label: "com.socketio.engineParseQueue", attributes: DispatchQueueAttributes.serial)
@ -103,6 +103,10 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
case let .path(path):
socketPath = path
case let .voipEnabled(enable):
if !socketPath.hasSuffix("/") {
socketPath += "/"
}
voipEnabled = enable
case let .secure(secure):
self.secure = secure
@ -116,7 +120,9 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
}
super.init()
sessionDelegate = sessionDelegate ?? self
(urlPolling, urlWebSocket) = createURLs()
}
@ -204,7 +210,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
}
}
emitQueue.async { self.doLongPoll(for: reqPolling as URLRequest) }
doLongPoll(for: reqPolling as URLRequest)
}
private func createURLs() -> (URL, URL) {
@ -453,9 +459,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
polling = true
probing = false
invalidated = false
session = URLSession(configuration: .default,
delegate: sessionDelegate,
delegateQueue: OperationQueue())
session = Foundation.URLSession(configuration: .default, delegate: sessionDelegate, delegateQueue: OperationQueue.main)
sid = ""
waitingForPoll = false
waitingForPost = false
@ -546,3 +550,11 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
}
}
}
extension SocketEngine {
public func URLSession(session: URLSession, didBecomeInvalidWithError error: NSError?) {
DefaultSocketLogger.Logger.error("Engine URLSession became invalid", type: "SocketEngine")
didError(reason: "Engine URLSession became invalid")
}
}