Motivation:
SwiftPM from Swift 5.0 brings targets that only support certain systems
which is really handy for this package as it only support macOS 10.14+
and iOS/tvOS 12+
Modifications:
- made use of the Swift 5.0 manifests which can have restrictions on the
supported platforms
- adapted to NIO 2
Result:
- better development story
- using the latest & greatest
Motivation:
In some cases, such as when an event loop has been shutdown, channel
registration may fail. In these cases, we would incorrectly attempt to
deregister the channel, which would fail (and in debug builds, assert).
Really, we shouldn't transition into .registered until we know that we have,
in fact, registered.
However, we need to be cautious: we don't want to register unless we
believe we're in an acceptable state to register.
Modifications:
Updated the state enum to perform the registration at the correct
part of the state change function.
Result:
Harder to crash in debug mode
Motivation:
We were inadvertently modifying the registration information of
NIOTSEventLoop objects from multiple threads, which is very not good.
Modifications:
Add an event loop execute to hop loops.
Result:
Thread safe!
Motivation:
Sadly I overlooked the fact that Channel.isActive is supposed to be
safe to call from multiple threads: the implementation here was not.
Modifications:
Store the active state into an Atomic.
Result:
It will be thread-safe to ask if a channel is active.
Motivation:
In some cases users may prefer not to wait for Network.framework to
reattempt connection in the future. Users should be able to opt-out of the
default waiting behaviour in those cases.
Modifications:
- Added WaitForActivity ChannelOption.
Result:
Users can configure channels better.
Motivation:
It is possible to receive the dataReceived callback after we've called
cancel, mostly because there may be such a block in place in the queue
before that cancel call fires. We should tolerate that.
Modifications:
Removed the invalid assertion.
Result:
Fewer failures.
Motivation:
If the user sets an unsupported ChannelOption we should give the best
diagnostics possible.
Modifications:
Add the ChannelOption type to the error message that it's unsupported.
Result:
Happier users
Motivation:
In SwiftNIO 1.11 we shipped improved interfaces for Channels to support
asserting being in the event loop. This is necessary because Dispatch
provides no non-precondition way to 100% guarantee that you are on a
specific queue, which is a requirement for accurate behaviour of
inEventLoop.
Modifications:
- Added an implementation of preconditionInEventLoop.
- Changed all assertions to use new interface.
- Required NIO 1.11.
Result:
Accurate assertions
Motivation:
One bugfix, some cleanliness.
Modifications:
`NIOTSListenerChannel.doClose0()` now evaluates and updates `self.bindPromise` irrespective of whether `self.nwListener` had been set.
Also, some case statements could be better: I've swapped `case _ as Thing:` with `case is Thing:`, and I've inlined the `let` value from `case _ as Thing: let thing = x as! Thing` to simply be `case let x as Thing:`.
Result:
If the call to create the `NWListener` in `NIOTSListenerChannel.beginActivating0()` throws an error, any promise passed to that method will now correctly be updated, where before it would be silently ignored, potentially causing a waiting caller to wait forever.
Also, no case statements remain that might cause damage to my tooth enamel.
* Use DispatchWorkItem.cancel() for cancellation. Make StateManagedChannel.beginActivating() use the same methodology as all the others.
* A needless `if let x = opt` that could be replaced with a question mark.
Motivation:
Today, SwiftPM unfortunately doesn't offer a great story for macOS/iOS
App development. Therefore we should recommend the
SwiftNIO/SwiftNIOTransportServices Pods.
Modifications:
recommend CocoaPods in the readme
Result:
Hopefully less frustration.
Motivation:
A number of users have asked for the ability to install
NIOTransportServices via Cocoapods. This is an entirely reasonable
request, so let's do it.
Modifications:
Added a script that can generate, and optionally upload, a specfile
for NIOTransportServices.
Result:
Users can use cocoapods if they prefer.
Motivation:
If an error is encountered early in the bootstrap process we should
probably not hit an assertion.
Modifications:
Added tests that we don't crash when closing idle channels.
Result:
Fewer crashes.
Motivation:
These are commonly-set socket options for channels, and we should
support them when using Transport Services as well.
Modifications:
Pass the socket options through to allowLocalEndpointReuse.
Result:
SO_REUSEADDR and SO_REUSEPORT will be available.