Skip to content

Commit 6147cda

Browse files
committed
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
2 parents 1af7bd8 + fcfb409 commit 6147cda

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ Carthage
8888
-----------------
8989
Add this line to your `Cartfile`:
9090
```
91-
github "socketio/socket.io-client-swift" ~> 6.1.5 # Or latest version
91+
github "socketio/socket.io-client-swift" ~> 6.1.6 # Or latest version
9292
```
9393

9494
Run `carthage update --platform ios,macosx`.
9595

96-
CocoaPods 0.36.0 or later (iOS 8+)
96+
CocoaPods 1.0.0 or later
9797
------------------
9898
Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
9999

100100
```ruby
101-
source 'https://github.com/CocoaPods/Specs.git'
102-
platform :ios, '8.0'
103101
use_frameworks!
104102

105-
pod 'Socket.IO-Client-Swift', '~> 6.1.5' # Or latest version
103+
target 'YourApp' do
104+
pod 'Socket.IO-Client-Swift', '~> 6.1.6' # Or latest version
105+
end
106106
```
107107

108108
Install pods:
@@ -121,7 +121,7 @@ import SocketIOClientSwift
121121
Objective-C:
122122

123123
```Objective-C
124-
#import <SocketIOClientSwift/SocketIOClientSwift-Swift.h>
124+
@import SocketIOClientSwift;
125125
```
126126

127127
CocoaSeeds
@@ -130,7 +130,7 @@ CocoaSeeds
130130
Add this line to your `Seedfile`:
131131

132132
```
133-
github "socketio/socket.io-client-swift", "v6.1.5", :files => "Source/*.swift" # Or latest version
133+
github "socketio/socket.io-client-swift", "v6.1.6", :files => "Source/*.swift" # Or latest version
134134
```
135135

136136
Run `seed install`.

Socket.IO-Client-Swift.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "Socket.IO-Client-Swift"
33
s.module_name = "SocketIOClientSwift"
4-
s.version = "6.1.5"
4+
s.version = "6.1.6"
55
s.summary = "Socket.IO-client for iOS and OS X"
66
s.description = <<-DESC
77
Socket.IO-client for iOS and OS X.
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.ios.deployment_target = '8.0'
1515
s.osx.deployment_target = '10.10'
1616
s.tvos.deployment_target = '9.0'
17-
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.5' }
17+
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.6' }
1818
s.source_files = "Source/**/*.swift"
1919
s.requires_arc = true
2020
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

Source/SSLSecurity.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class SSLSecurity : NSObject {
5555

5656
var isReady = false //is the key processing done?
5757
var certificates: [NSData]? //the certificates
58-
var pubKeys: [SecKeyRef]? //the public keys
58+
@nonobjc var pubKeys: [SecKeyRef]? //the public keys
5959
var usePublicKeys = false //use public keys or certificate validation?
6060

6161
/**
@@ -241,7 +241,7 @@ public class SSLSecurity : NSObject {
241241

242242
- returns: the public keys from the certifcate chain for the trust
243243
*/
244-
func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] {
244+
@nonobjc func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] {
245245
let policy = SecPolicyCreateBasicX509()
246246
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKeyRef]()) { (keys: [SecKeyRef], index: Int) -> [SecKeyRef] in
247247
var keys = keys

Source/SocketEngine.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import Foundation
2626

27-
public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWebsocket {
27+
public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket {
2828
public let emitQueue = dispatch_queue_create("com.socketio.engineEmitQueue", DISPATCH_QUEUE_SERIAL)
2929
public let handleQueue = dispatch_queue_create("com.socketio.engineHandleQueue", DISPATCH_QUEUE_SERIAL)
3030
public let parseQueue = dispatch_queue_create("com.socketio.engineParseQueue", DISPATCH_QUEUE_SERIAL)
@@ -102,6 +102,10 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
102102
forceWebsockets = force
103103
case let .Path(path):
104104
socketPath = path
105+
106+
if !socketPath.hasSuffix("/") {
107+
socketPath += "/"
108+
}
105109
case let .VoipEnabled(enable):
106110
voipEnabled = enable
107111
case let .Secure(secure):
@@ -117,6 +121,8 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
117121

118122
super.init()
119123

124+
sessionDelegate = sessionDelegate ?? self
125+
120126
(urlPolling, urlWebSocket) = createURLs()
121127
}
122128

@@ -205,9 +211,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
205211
}
206212
}
207213

208-
dispatch_async(emitQueue) {
209-
self.doLongPoll(reqPolling)
210-
}
214+
doLongPoll(reqPolling)
211215
}
212216

213217
private func createURLs() -> (NSURL, NSURL) {
@@ -456,7 +460,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
456460
invalidated = false
457461
session = NSURLSession(configuration: .defaultSessionConfiguration(),
458462
delegate: sessionDelegate,
459-
delegateQueue: NSOperationQueue())
463+
delegateQueue: NSOperationQueue.mainQueue())
460464
sid = ""
461465
waitingForPoll = false
462466
waitingForPost = false
@@ -549,3 +553,11 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
549553
}
550554
}
551555
}
556+
557+
extension SocketEngine {
558+
public func URLSession(session: NSURLSession, didBecomeInvalidWithError error: NSError?) {
559+
DefaultSocketLogger.Logger.error("Engine URLSession became invalid", type: "SocketEngine")
560+
561+
didError("Engine URLSession became invalid")
562+
}
563+
}

0 commit comments

Comments
 (0)