# Motivation
We introduced a new configuration struct for `NIOAsyncChannel` to make handling and configuring it easier.
# Modification
This PR adopts the new APIs.
# Result
Less boilerplate in our bootstrap methods
* Extract the NWConnection code into StateManagedNWConnectionChannel
* Add a general setup for NWListener implementations
* Add support for UDPOptions as a NWOptionsProtocol type
* Complete the rebase to main
* Fix nits from PR review
* Clean up some of the invalid rebase
* Extract the NWConnection code into StateManagedNWConnectionChannel
* Process cory's feedback
* Remove dead code whose functionality is already handled by the helper protocol
* Make the address cache non-locked, because its lock has been moved to the accessors
* Move getting the Multipath option into the TCP channel, re-introduce the underscores to the addressCache properties
* Drop the umbrella import
---------
Co-authored-by: Cory Benfield <lukasa@apple.com>
* Async methods for `NIOTSListenerBootstrap` and `NIOTSConnectionBootstrap`
# Motivation
We want to support async bootstrapping with all our bootstraps.
# Modification
This PR adds support for the `NIOTSListenerBootstrap` and `NIOTSConnectionBootstrap`. It also adds the three variants of methods to it (abstract output, `NIOAsyncChannel` based and protocol negotiation based)
# Result
We now support asynchronous interaction with the `NIOTSListenerBootstrap` and `NIOTSConnectionBootstrap`
* Use protocolHandlers properly
* Update NIO version
* code review
* REview
* Doc indention
Motivation:
We're centralizing on the Swift code of conduct, so we'll x-reference
that instead of holding our own.
Modifications:
Hyperlink out to Swift.
Result:
Shared CoC across the projects.
### Motivation
`swift-nio` has deprecated `NIOPreconcurrencySendable` in `2.51.0`. Removing the protocol conformance would be an API breaking change. Keeping the conformance is low cost and not worth the risk.
### Changes
- replace `NIOPreconcurrencySendable` with underscore version `_NIOPreconcurrencySendable`
### Result
We compile again with the latest `swift-nio` release without warnings
* Drop support for Swift 5.5
Signed-off-by: Si Beaumont <beaumont@apple.com>
* fixup: Next version will be 1.17.0
Signed-off-by: Si Beaumont <beaumont@apple.com>
---------
Signed-off-by: Si Beaumont <beaumont@apple.com>
Motivation:
We try to support building our docs on Linux too, but that means we
can't explicitly reference any symbols from `index.md`.
Modifications:
Enable CI-ing docs.
Result:
Docs will render on Linux too.
Motivation:
The NIO docs are now published on the Swift Package Index but the README
still refers to GitHub pages.
Modifications:
- Update README and other docs to point to Swift Package Index.
Result:
Documentation links work
Motivation
As we've rolled out support for multicast on Linux, it makes sense to
add equivalent configuration for swift-nio-transport-services. The two
features aren't one-to-one, as Network.framework has substantially more
capability than the Linux functionality.
Modifications
- Expose a multipathServiceType channel option
- Add a test to confirm we use it properly
Result
Multicast service types are available.
Motivation:
#fileID introduced in Swift 5.3, so no longer need to use #file anywhere
Modifications:
Changed #file to #filePath or #fileID depending on situation
* Allow retrieval of metadata for a specific protocol from the underlying `NWConnection`
* Address review comments
* Address review comment
* Add availability annotation to tests
* Rename `NIOTSChannelIsNotATransportServicesChannel ` to `NIOTSChannelIsNotANIOTSConnectionChannel `
Motivation:
SwiftNIO periodically drops support for older Swift versions. Now that
5.7 has been released, 5.4 will be dropped.
Modifications:
- Remove 5.4 specific Package.swift and docker-compose
- Update the 5.7 docker-compose to use the released 5.7 and move from
focal (2004) to jammy (2204)
- Update docs
Results:
Minimum Swift version is 5.5
Motivation:
- NIOTSConnectionBootstrap was extended to be marked as non-Sendable,
this extenion missed the availability annotations.
Modifications:
- Add appropriate availability annotation
Result:
Resolves#159
Motivation:
Lock has been deprecated in favour of NIOLock. Warnings aren't great.
Modifications:
- Replace Lock with NIOLock
- Update the minimum required NIO version to 2.42.0.
Result:
Everything builds cleanly
NIO Transport Services is not capable of launching services with existing NWConnection or NWListener objects. Being able to get
an existing NWConnection through a connection bootstrap and into a channel is a useful capability for advanced use cases.
Modifications:
* Added an option to bootstrap with existing NWListener and NWConnection
* Completed promise connection earlier within NIOTSChannels when AlreadyConfigured is called
* Added test with new NWConnection and NWListener to register Channels
Result:
Able to create and register a channel using an existing NWListener and NWConnection
Motivation
Documentation is nice, and we can help support users by providing useful
clear docs.
Modifications
Add Docc to 5.6 and later builds
Make sure symbol references work
Add overview docs
Result
Nice rendering docs
Motivation:
Right now we're playing a little fast and loose with the lifetimes of
the sec_protocol_metadata_t. As a practical matter it is highly likely
that this is owned (and so kept alive by) the NWConnection, but rather
than risk that we should tighten up the lifetime management.
Modifications:
Use withExtendedLifetime to extend the lifetime.
Result:
Better lifetime management.
Motivation:
We no longer support Cocoapods and `swift package generate-xcodeproj` is
deprecated, so we shouldn't advertise their usage in the README.
Modifications:
Remove Cocoapods and `swift package generate-xcodeproj` sections from
the README.
Result:
More up-to-date README
Motivation:
When we're waiting for connectivity, the user might tell us that they
aren't interested in waiting. In that case we take advantage of the
signal and close early.
However, the code as-written had a bug: we didn't care whether the user
told us they _didn't_ want to wait, or they _did_: we just closed
because they had an opinion! That's no good! We should only close if
they don't want to wait.
Modifications:
- Only close if the user doesn't want to wait.
- Add tests
Result:
We won't close if users don't want us to.
Motivation:
Private Relay kicks in to secure unencrypted data transfers, and
connections to port 80 are a good signal. As a result, the current
construction of this test will invoke Private Relay and attempt to route
over it.
While Private Relay is in beta this is a bad outcome, as it risks
causing bugs in unusual network scenarios. So let's tell Private Relay
we don't need it.
Modifications:
Pretend we're gonna connect to 443 instead.
Result:
More reliable test.
Motivation:
To workaround https://github.com/apple/swift-nio/issues/2073 we must
list all transitive dependencies when building podspecs.
Modifications:
- Include transitive dependencies in the build_podspec script
- The list of dependencies was generated using
the `list_transitive_dependencies.py` from the NIO repo.
Result:
Podspec generation script includes transitive dependencies.
As outlined in a [Swift forums post in November ’21](https://forums.swift.org/t/swiftnio-swift-version-support/53232), SwiftNIO will only support the latest non-patch Swift release and the 2 immediately prior non-patch versions.
- drop support for Swift 5.2 and 5.3.
- update CI for Swift 5.4 to run on bionic instead of focal to ensure that we still test bionic.
- add a CI job for Swift 5.7
Motivation:
When a task is scheduled using a `DispatchTimerSource` on a `NIOTSEventLoop`
the source is retain via a callback on the promise associated with the
scheduled task. This stops the source from deinit'd before the task is
run. However, the callback being added is an implementation details of
`Scheduled` and the retain cycle is incidental.
If that detail chnaged (such as in
https://github.com/apple/swift-nio/pull/2011) then tasks may not run and
the promise could be leaked.
Modifications:
- Explicitly add a retain cycle between the future and the timer source
which is broken by the promise being completed and callbacks run.
Result:
The timer source is kept alive until the event fires.
Motivation:
With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.
Modifications:
- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded imports where necessary in tests.
- Note that the main package still _depends_ on NIO, which is necessary
for backwards-compatibility reasons. This dependency is unused.
Result:
No need to use NIOPosix.
Motivation:
The event loop state is not protected for access on different threads.
This means it must only be accessed from the task queue.
Modifications:
Move check for event loop shutdown into taskQueue
Result:
Event Loop state only accessed from the task queue.
Motivation:
`removeHandlers(channel:)` was deprecated in NIO 2.32.0.
Modifications:
- Raise minimum required NIO version to 2.32.0
- Use `removeHandlers(pipeline:)`
Result:
We don't use deprecated API.
Motivation:
NIO 2.27.0 added optional support for synchronous channel options.
NIOTSListenerChannel and NIOTSConnectionChannel should support this.
Modifications:
- Add synchronous options for NIOTSConnectionChannel and
NIOTSListenerChannel
- Avoid an allocation in 'getOption' for each channel if the caller is
already on the right event loop by using 'makeSucceededFuture'
- Remove a no longer used internal function and an already dead private
helper
Result:
- Support for sync options and fewer allocations
Motivation:
We shouldn't crash if the user gives us a bad port.
Modifications:
- Check the ports are in-band before we move on.
Result:
We won't crash.
Motivation:
xcodebuild complains during Cocapods validation (which fails as a
result) about a redundant availability check. It's redundant because for
watchOS the availability guard on the outer scope has the same
conditions (for other platforms the conditions are tighter in the
inner scope). We never hit this before because we only recently added
watchOS to the supported platforms for Cocapods.
Modifications:
- Remove a redundant availability check
Result:
- Cocapods can validate without error
Motivation:
The zero-length writes handler will crash if it receives channelInactive
before channelActive. Sadly, that's totally possible if a channel is
closed from the connect promise.
Modifications:
- Tone back the preconditions a bit.
- Add a test that triggers this path.
Result:
Channel handler behaves better on early close