Skip to content

Commit

Permalink
Updates for the new swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Abt committed Jun 22, 2016
1 parent 6e8915c commit 4974f5c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 28 deletions.
5 changes: 4 additions & 1 deletion BlueSocket.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = IBM;
TargetAttributes = {
8C0F4BF51C4E84CC008B2B0A = {
Expand Down Expand Up @@ -420,6 +420,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.oss.Socket;
PRODUCT_NAME = Socket;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand All @@ -444,6 +445,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.oss.SocketTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand Down Expand Up @@ -489,6 +491,7 @@
PRODUCT_NAME = BlueSocket;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Binary file not shown.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ Socket framework for Swift using the Swift Package Manager. Works on OS X and Li
## Prerequisites

### Swift
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a` toolchain (**Minimum REQUIRED for latest release**)
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-05-31-a` toolchain
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-06-06-a` toolchain (**Recommended**)
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a` toolchain (**Minimum REQUIRED for latest release**)

### OS X

* OS X 10.11.0 (*El Capitan*) or higher
* Xcode Version 7.3.1 (7D1012) or higher using the one of the above toolchains (*Recommended*)
* Xcode Version 8.0 beta (8S128d) or higher using the above toolchain (*Recommended*)

### Linux

* Ubuntu 15.10 (or 14.04 but only tested on 15.10)
* One of the Swift Open Source toolchains listed above
* The Swift Open Source toolchain listed above

### Add-ons

Expand Down
57 changes: 38 additions & 19 deletions Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,11 @@ public class Socket: SocketReader, SocketWriter {
// Let the delegate do post accept handling and verification...
do {

try self.delegate?.onAccept(socket: newSocket)
try self.delegate?.verifyConnection()
newSocket.signature?.isSecure = true
if self.delegate != nil {
try self.delegate?.onAccept(socket: newSocket)
try self.delegate?.verifyConnection()
newSocket.signature?.isSecure = true
}

} catch let error {

Expand Down Expand Up @@ -1188,9 +1190,11 @@ public class Socket: SocketReader, SocketWriter {
// Let the delegate do post accept handling and verification...
do {

try self.delegate?.onAccept(socket: self)
try self.delegate?.verifyConnection()
self.signature?.isSecure = true
if self.delegate != nil {
try self.delegate?.onAccept(socket: self)
try self.delegate?.verifyConnection()
self.signature?.isSecure = true
}

} catch let error {

Expand Down Expand Up @@ -1413,9 +1417,11 @@ public class Socket: SocketReader, SocketWriter {
// Let the delegate do post connect handling and verification...
do {

try self.delegate?.onConnect(socket: self)
try self.delegate?.verifyConnection()
self.signature?.isSecure = true
if self.delegate != nil {
try self.delegate?.onConnect(socket: self)
try self.delegate?.verifyConnection()
self.signature?.isSecure = true
}

} catch let error {

Expand Down Expand Up @@ -1501,9 +1507,11 @@ public class Socket: SocketReader, SocketWriter {
// Let the delegate do post connect handling and verification...
do {

try self.delegate?.onConnect(socket: self)
try self.delegate?.verifyConnection()
self.signature?.isSecure = true
if self.delegate != nil {
try self.delegate?.onConnect(socket: self)
try self.delegate?.verifyConnection()
self.signature?.isSecure = true
}

} catch let error {

Expand Down Expand Up @@ -1795,15 +1803,22 @@ public class Socket: SocketReader, SocketWriter {

let rc = try self.read(into: data)

guard let str = NSString(data: data, encoding: NSUTF8StringEncoding)
where rc > 0 else {

throw Error(code: Socket.SOCKET_ERR_INTERNAL, reason: "Unable to convert data to NSString.")
}

#if os(Linux)
guard let str = NSString(data: data, encoding: NSUTF8StringEncoding)
where rc > 0 else {

throw Error(code: Socket.SOCKET_ERR_INTERNAL, reason: "Unable to convert data to NSString.")
}
return str.bridge()

#else
guard let str = NSString(data: data as Data, encoding: String.Encoding.utf8.rawValue)
where rc > 0 else {

throw Error(code: Socket.SOCKET_ERR_INTERNAL, reason: "Unable to convert data to NSString.")
}


return str as String
#endif

Expand Down Expand Up @@ -1844,7 +1859,11 @@ public class Socket: SocketReader, SocketWriter {
if count > 0 {

// - Yes, move to caller's buffer...
data.append(self.readStorage)
#if os(Linux)
data.append(self.readStorage)
#else
data.append(self.readStorage as Data)
#endif

returnCount = self.readStorage.length

Expand Down

0 comments on commit 4974f5c

Please sign in to comment.