Merge branch 'development'

* development:
  bump version
  add check for bad paths
  Fix socketpollable crashing
  make nonobjc
  More privatisation
  Making publicKeyChainForTrust() private.
  api extensions doesn't seem to fail for me
  update readme
  don't use api extensions only
This commit is contained in:
Erik 2016-07-29 19:38:16 -04:00
commit 6147cda561
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
4 changed files with 28 additions and 16 deletions

View File

@ -88,21 +88,21 @@ Carthage
----------------- -----------------
Add this line to your `Cartfile`: 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`. 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'`: Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
```ruby ```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks! 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: Install pods:
@ -121,7 +121,7 @@ import SocketIOClientSwift
Objective-C: Objective-C:
```Objective-C ```Objective-C
#import <SocketIOClientSwift/SocketIOClientSwift-Swift.h> @import SocketIOClientSwift;
``` ```
CocoaSeeds CocoaSeeds
@ -130,7 +130,7 @@ CocoaSeeds
Add this line to your `Seedfile`: 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`. Run `seed install`.

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift" s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIOClientSwift" 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.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC s.description = <<-DESC
Socket.IO-client for iOS and OS X. Socket.IO-client for iOS and OS X.
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0' s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10' s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0' 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.source_files = "Source/**/*.swift"
s.requires_arc = true s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files # s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

View File

@ -55,7 +55,7 @@ public class SSLSecurity : NSObject {
var isReady = false //is the key processing done? var isReady = false //is the key processing done?
var certificates: [NSData]? //the certificates var certificates: [NSData]? //the certificates
var pubKeys: [SecKeyRef]? //the public keys @nonobjc var pubKeys: [SecKeyRef]? //the public keys
var usePublicKeys = false //use public keys or certificate validation? var usePublicKeys = false //use public keys or certificate validation?
/** /**
@ -241,7 +241,7 @@ public class SSLSecurity : NSObject {
- returns: the public keys from the certifcate chain for the trust - returns: the public keys from the certifcate chain for the trust
*/ */
func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] { @nonobjc func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] {
let policy = SecPolicyCreateBasicX509() let policy = SecPolicyCreateBasicX509()
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKeyRef]()) { (keys: [SecKeyRef], index: Int) -> [SecKeyRef] in let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKeyRef]()) { (keys: [SecKeyRef], index: Int) -> [SecKeyRef] in
var keys = keys var keys = keys

View File

@ -24,7 +24,7 @@
import Foundation import Foundation
public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWebsocket { public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket {
public let emitQueue = dispatch_queue_create("com.socketio.engineEmitQueue", DISPATCH_QUEUE_SERIAL) public let emitQueue = dispatch_queue_create("com.socketio.engineEmitQueue", DISPATCH_QUEUE_SERIAL)
public let handleQueue = dispatch_queue_create("com.socketio.engineHandleQueue", DISPATCH_QUEUE_SERIAL) public let handleQueue = dispatch_queue_create("com.socketio.engineHandleQueue", DISPATCH_QUEUE_SERIAL)
public let parseQueue = dispatch_queue_create("com.socketio.engineParseQueue", DISPATCH_QUEUE_SERIAL) public let parseQueue = dispatch_queue_create("com.socketio.engineParseQueue", DISPATCH_QUEUE_SERIAL)
@ -102,6 +102,10 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
forceWebsockets = force forceWebsockets = force
case let .Path(path): case let .Path(path):
socketPath = path socketPath = path
if !socketPath.hasSuffix("/") {
socketPath += "/"
}
case let .VoipEnabled(enable): case let .VoipEnabled(enable):
voipEnabled = enable voipEnabled = enable
case let .Secure(secure): case let .Secure(secure):
@ -117,6 +121,8 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
super.init() super.init()
sessionDelegate = sessionDelegate ?? self
(urlPolling, urlWebSocket) = createURLs() (urlPolling, urlWebSocket) = createURLs()
} }
@ -205,9 +211,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
} }
} }
dispatch_async(emitQueue) { doLongPoll(reqPolling)
self.doLongPoll(reqPolling)
}
} }
private func createURLs() -> (NSURL, NSURL) { private func createURLs() -> (NSURL, NSURL) {
@ -456,7 +460,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
invalidated = false invalidated = false
session = NSURLSession(configuration: .defaultSessionConfiguration(), session = NSURLSession(configuration: .defaultSessionConfiguration(),
delegate: sessionDelegate, delegate: sessionDelegate,
delegateQueue: NSOperationQueue()) delegateQueue: NSOperationQueue.mainQueue())
sid = "" sid = ""
waitingForPoll = false waitingForPoll = false
waitingForPost = false waitingForPost = false
@ -549,3 +553,11 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
} }
} }
} }
extension SocketEngine {
public func URLSession(session: NSURLSession, didBecomeInvalidWithError error: NSError?) {
DefaultSocketLogger.Logger.error("Engine URLSession became invalid", type: "SocketEngine")
didError("Engine URLSession became invalid")
}
}