Tags: goalfinance/swift-nio
Tags
Rename misnamed closure parameter argument in ServerBootstrap.bind0 (a… …pple#1347) Motivation: Non-functional change: `bind0(_ makeSocketAddress: () throws -> SocketAddress) -> EventLoopFuture<Channel>` calls `bind0` with a `register` closure that is passed an event loop as first argument. However, the name of the first parameter of the closure declaration is named "eventGroup" which is confusing. It should therefore be renamed to "eventLoop" which is consistent with other closures passed as `register` arguments at other callsites. Modifications: Rename (unused) closure parameter "eventGroup" to "eventLoop". Result: Improved code readability. Co-authored-by: Johannes Weiss <[email protected]>
Drain scheduled tasks on EmbeddedChannel finish() (apple#1319) Motivation: EmbeddedChannel advanced time to the distant future so that all scheduled tasks would be run. However, if tasks were recursively scheduled by executing the already scheduled tasks then the channel would never finish. Modifications: When calling finish() on EmbeddedChannel, only run the tasks which have been scheduled at that point in time. Result: Recursively scheduled tasks terminate when finish-ing the EmbeddedChannel.
workaround failed associated type inference (apple#1299) Motivation: Some Swift nightly snapshots fail to compile NIO in release mode (rdar://57793267), this change is to work around this issue by telling them compiler the associatedtypes explicitly. Modifications: - add `Element` and `Indices` typealises to `CircularBuffer` explicitly. Result: Complies on all nightlies also in release mode.
fix AtomicBox by deprecating it and implementing it with a CAS loop (a… …pple#1287) Motivation: Atomic references cannot easily be maintained correctly because the `load` operation gets a pointer value that might (before the loader gets a change to retain the returned reference) be destroyed by another thread. Modifications: - Deprecate `AtomicBox` - Implement `NIOCASLoopBox` with functionality similar to AtomicBox (but implemented using a CAS loop :( ). Result: - fixes apple#1286
Fix running run-nio-alloc-counter-tests.sh for a single test (apple#1245 ) Motivation: Using the single test argument with the run-nio-alloc-counter-tests.sh does not work as expected as the given test would just replace the first test in the list. Modifications: Replace the tests to run with a single-element array containing the test provided as an argument. Result: - A single test can be run when specified as a command line arg.
Allow single test to be specified as an argument to run-nio-alloc-cou… …nter-tests.sh. (apple#1214) * Allow single test to be specified as an argument to run-nio-alloc-counter-tests.sh. Motivation: run-nio-alloc-counter-tests.sh currently runs all tests. When writing or debugging a test, you commonly want to run a single test. At the moment the common practice is to edit the script to hardcode a test to run, which is annoying and error-prone. Modifications: Add an optional argument to the script to specify the test to run. Result: $ ./run-nio-alloc-counter-tests.sh runs all tests. $ ./run-nio-alloc-counter-tests.sh test_decode_1000_ws_frames.swift runs only test_decode_1000_ws_frames.swift.
Add option to reserve writable capacity to writeWithUnsafeMutableBytes ( apple#1105) (apple#1175) Motivation: writeWithUnsafeMutableBytes cannot tolerate arbitrarily large writes because it is not possible to resize the buffer by the time body receives the buffer pointer. This change provides an option for the user to reserve writable capacity before the pointer is passed to body. Modifications: Added a backward compatible optional parameter to writeWithUnsafeMutableBytes which can reserve writable capacity before the pointer is passed to body. Result: Additive change only. Users can optionally specify a minimum writable capacity when calling writeWithUnsafeMutableBytes.
Allow promises to be completed with a `Result<Value, Error>` (apple#1124 ) Motivation: When dealing with `Result` types and promises it is inconvenient having to switch over the result in order to succeed or fail a promise. Modifications: - Allow promises to be completed with a `Result<Value, Error>` directly. - Added tests. Result: Promises are easier to fulfill with `Result` types.
BaseSocketChannel: accept immediately closed socket (apple#1121) Motivation: In the grpc-swift test suite, we saw a case where the server would always immediately close the accepted socket. This lead NIO to misbehave badly because kqueue would send us the `readEOF` before the `writable` event that finishes an asynchronous `connect`. What happened is that we just dropped the `readEOF` on the floor so we would never actually tell the user if the channel ever went away. Modifications: Only register for `readEOF` after becoming active. Result: - we're happy with servers that immediately close the socket
Remove `cpp_magic.h` import and ancient Clang compatibility hack from… … `CNIOAtomics.h` (apple#1111) The inclusion of `cpp_magic.h` in `CNIOAtomics.h` is unnecessary and pollutes the namespace of anyone else importing the header. NIO now also requires Swift 5, which itself will not be built with a Clang too old to understand `_Nonnull`. Note: Removing the extra import of cpp-magic.h required moving it to the src/ directory to avoid complaints about its inclusion (or lack thereof) in the module's umbrella header.
PreviousNext