-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,15 @@ | |
// File: SwifterSockets.Connection.swift | ||
// Project: SwifterSockets | ||
// | ||
// Version: 0.10.11 | ||
// Version: 0.12.0 | ||
// | ||
// Author: Marinus van der Lugt | ||
// Company: http://balancingrock.nl | ||
// Website: http://swiftfire.nl/pages/projects/swiftersockets/ | ||
// Blog: http://swiftrien.blogspot.com | ||
// Git: https://github.com/Swiftrien/SwifterSockets | ||
// | ||
// Copyright: (c) 2016-2017 Marinus van der Lugt, All rights reserved. | ||
// Copyright: (c) 2016-2019 Marinus van der Lugt, All rights reserved. | ||
// | ||
// License: Use or redistribute this code any way you like with the following two provision: | ||
// | ||
|
@@ -35,11 +35,6 @@ | |
// | ||
// (It is always a good idea to visit the website/blog/google to ensure that you actually pay me and not some imposter) | ||
// | ||
// For private and non-profit use the suggested price is the price of 1 good cup of coffee, say $4. | ||
// For commercial use the suggested price is the price of 1 good meal, say $20. | ||
// | ||
// You are however encouraged to pay more ;-) | ||
// | ||
// Prices/Quotes for support, modifications or enhancements can be obtained from: [email protected] | ||
// | ||
// ===================================================================================================================== | ||
|
@@ -48,6 +43,7 @@ | |
// | ||
// History | ||
// | ||
// 0.12.0 - Replaced depreciated call in Swift 5 | ||
// 0.10.11 - Migration to Swift 4, minor adjustments. | ||
// 0.10.8 - Made incrementUsageCount and decrementUsageCount public. | ||
// 0.10.7 - Bugfix: partial reimplementation to prevent crashes due to clashes of receiver events and close events. | ||
|
@@ -801,9 +797,8 @@ open class Connection: ReceiverProtocol, TransmitterProtocol { | |
callback: TransmitterProtocol? = nil, | ||
progress: TransmitterProgressMonitor? = nil) -> TransferResult { | ||
|
||
return data.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) -> TransferResult in | ||
let buffer = UnsafeBufferPointer<UInt8>.init(start: ptr, count: data.count) | ||
return self.transfer(buffer, timeout: timeout, affectInactivityDetection: affectInactivityDetection, callback: callback, progress: progress) | ||
return data.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) -> TransferResult in | ||
return self.transfer(buffer.bindMemory(to: UInt8.self), timeout: timeout, affectInactivityDetection: affectInactivityDetection, callback: callback, progress: progress) | ||
} | ||
} | ||
|
||
|
@@ -949,9 +944,8 @@ open class Connection: ReceiverProtocol, TransmitterProtocol { | |
callback: TransmitterProtocol? = nil, | ||
progress: TransmitterProgressMonitor? = nil) -> TransferResult { | ||
|
||
return data.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) -> TransferResult in | ||
let buffer = UnsafeBufferPointer<UInt8>.init(start: ptr, count: data.count) | ||
return self.bufferedTransfer(buffer, timeout: timeout, affectInactivityDetection: affectInactivityDetection, callback: callback, progress: progress) | ||
return data.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) -> TransferResult in | ||
return self.bufferedTransfer(buffer.bindMemory(to: UInt8.self), timeout: timeout, affectInactivityDetection: affectInactivityDetection, callback: callback, progress: progress) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,15 @@ | |
// File: SwifterSockets.Transmit.swift | ||
// Project: SwifterSockets | ||
// | ||
// Version: 0.10.6 | ||
// Version: 0.12.0 | ||
// | ||
// Author: Marinus van der Lugt | ||
// Company: http://balancingrock.nl | ||
// Website: http://swiftfire.nl/pages/projects/swiftersockets/ | ||
// Blog: http://swiftrien.blogspot.com | ||
// Git: https://github.com/Balancingrock/SwifterSockets | ||
// | ||
// Copyright: (c) 2014-2017 Marinus van der Lugt, All rights reserved. | ||
// Copyright: (c) 2014-2019 Marinus van der Lugt, All rights reserved. | ||
// | ||
// License: Use or redistribute this code any way you like with the following two provision: | ||
// | ||
|
@@ -35,11 +35,6 @@ | |
// | ||
// (It is always a good idea to visit the website/blog/google to ensure that you actually pay me and not some imposter) | ||
// | ||
// For private and non-profit use the suggested price is the price of 1 good cup of coffee, say $4. | ||
// For commercial use the suggested price is the price of 1 good meal, say $20. | ||
// | ||
// You are however encouraged to pay more ;-) | ||
// | ||
// Prices/Quotes for support, modifications or enhancements can be obtained from: [email protected] | ||
// | ||
// ===================================================================================================================== | ||
|
@@ -48,6 +43,7 @@ | |
// | ||
// History | ||
// | ||
// 0.12.0 - Replaced depreciated call in Swift 5 | ||
// 0.10.6 - Added closing of the socket on transmitterClosed. | ||
// 0.9.14 - Moved transmitter protocol to this file | ||
// - Moved progress signature to this file | ||
|
@@ -332,9 +328,8 @@ public func tipTransfer( | |
callback: TransmitterProtocol? = nil, | ||
progress: TransmitterProgressMonitor? = nil) -> TransferResult { | ||
|
||
return data.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) -> TransferResult in | ||
let ubptr = UnsafeBufferPointer<UInt8>.init(start: ptr, count: data.count) | ||
return tipTransfer(socket: socket, buffer: ubptr, timeout: timeout, callback: callback, progress: progress) | ||
return data.withUnsafeBytes { (urbp: UnsafeRawBufferPointer) -> TransferResult in | ||
return tipTransfer(socket: socket, buffer: urbp.bindMemory(to: UInt8.self), timeout: timeout, callback: callback, progress: progress) | ||
} | ||
} | ||
|
||
|