Workaround a compiler issue in Swift 6.1 with non-copyable types and
exclusivity checking.
### Motivation:
Code introduced in #298, led to a runtime crash when compiling with
`-Xswiftc -enforce-exclusivity=unchecked`. This fixes the issue by
removing non-copyable types from the implementation, whilst retaining a
fix for copy-on-write behaviour.
### Modifications:
- Change LifecycleStateMachine to not use non-copyable types
- Use a `.modifying` state instead to prevent copy-on-write
### Result:
No runtime crash when compiling with exclusivity checks disabled on
swift 6.1, behaviour otherwise unchanged, apart from possible
performance loss from not using non-copyable types.
Fix a copy on write issue in QuiescingHelper that led to significant
performance problems when the number of channels became large, or
connection churn.
### Motivation:
When using QuiescingHelper, every channel holds onto a reference to
ChannelCollector, which leads to copy on write behaviour for
`openChannels[]`. This has performance issues when a large number of
channels are open (e.g. 25k channels can be hundreds of KB), and every
time a channel is opened, or closed this is copied. As accepting
channels happens on a single NIO thread, this work is all done on that
thread, and can lead to saturation, and no more channels being accepted.
### Modifications:
Move the state into a non copyable LifecycleStateMachine, to avoid the
copies.
### Result:
Overhead from ChannelCollector disappears (as seen in traces from
http://github.com/apple/swift-profile-recorder).
### Motivation:
To migrate to GitHub actions and centralised infrastructure.
### Modifications:
Changes of note:
* Adopt swift-format using rules from SwiftNIO
* Remove scripts and docker files which are no longer needed
### Result:
Feature parity with old CI.
# Motivation
Currently the `QuiescingHelper` is crashing on a precondition if you call shutdown when it already was shutdown. However, that can totally happen and we should support it.
# Modification
Refactor the `QuiescingHelper` to exhaustively switch over its state in every method. Furthermore, I added a few more test cases to test realistic scenarios.
# Result
We are now reliable checking our state and making sure to allow most transitions.
* ServerQuiescingHelper no longer leaking promises
Motivation:
ServerQuiescingHelper leaked promises when promise left scope and not succeeded
Modifications:
Failing promise within a deinit
* Minor fixes
* generating linux tests
* mini update
* Improve documentation for NIOExtras
Motivation:
Docs will help users do things correctly.
Modifications:
Add missing comments, improve links.
Result:
Better docc documentation
* Docc in NIOHTTPCompression
* NIOSOCKS docc
* Correct bad symbol
* Minor typo
Co-authored-by: Cory Benfield <lukasa@apple.com>
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 and NIOPosix imports where necessary in tests.
- Extended soundness script to detect NIO imports.
- Note that the main modules still depend on NIO, which is necessary
for backwards-compatibility reasons. This dependency is unused.
Result:
No need to use NIOPosix.
Motivation:
ServerQuiescingHelper used to swallow close errors and it shoulnd't do
that.
Modifications:
Don't swallow close errors.
Result:
More correctness.
Motivation:
In a few cases quiescing a server application is useful but it's harder
than necessary with core-NIO. Therefore this adds a helper & a
demonstration.
Modifications:
- add `QuiescingHelper` which helps users to quiesce a channel by
collecting all accepted channels and when needed sends them the
quiescing user event. When all collected channels have closed the
user will be notified and can just shut down the ELG.
- added a demo implementation with a simple HTTP server that quiesces
when receiving a signal
Result:
Make it quite easy to quiesce a server and show users how to do it.