Commit Graph
5 Commits
Author SHA1 Message Date
Rick Newton-Rogers 530aa8d304 NIOSingleStepByteToMessageDecoder reentrancy safety (#2881)
### Motivation:

`NIOSingleStepByteToMessageDecoder` calls out part way through its
processing step to a user-provided closure which can cause re-entrant
behavior which violates the assumption made in the code that if the
buffer is non-empty at the start that will be true later in the method.

### Modifications:

`NIOSingleStepByteToMessageDecoder` no longer assumes a non-empty buffer
in its final phase of buffer management.

Further changes to protect against re-entrancy shouldn't be necessary
because the outside call to `messageReceiver` is the only one which is
permitted to be re-entrant (`decode` and `decodeLast` are not).

### Result:

`NIOSingleStepByteToMessageDecoder` can handle re-entrant processing
calls.
2024-09-13 11:43:44 +01:00
Franz Busch c9756e1083 Adopt swift-format (#2794)
* Apply formatting

* Apply no block comments rule

* Apply OmitExplicitReturns

* Apple OnlyOneTrailingClosureArgument

* Apply NoAssignmentInExpressions

* Fix up DontRepeatTypeInStaticProperties lint errors

* Apply `OrderedImports`

* Apply `ReplaceForEachWithForLoop`

* format file

* Enable the formatting pipeline

* Adopt `AmbiguousTrailingClosureOverload`

* Fix license header

* Fix format check

* Fix `EndOfLineComment`

* Fix CI

* Adapt CI script to check if changes when running formatting

* Separate lint and format into to steps

* Fix format

* Adopt `UseEarlyExits`

* Revert "Adopt `UseEarlyExits`"

This reverts commit d1ac5bbe12.
2024-07-19 11:48:17 +02:00
Johannes Weiss 7948ed2104 ChannelHandler: provide static (un)wrap(In|Out)bound(In|Out) (#2791) 2024-07-18 11:55:48 +01:00
Fabian Fett 546eaa261e Add unprocessedBytes property on NIOSingleStepByteToMessageProcessor (#2419) 2023-05-03 17:19:13 +01:00
Si BeaumontandCory Benfield cd11cf8202 Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093)
* Move tests of NIOCore types from NIOPosixTests to NIOCoreTests

* fixup: LinuxTest

Signed-off-by: Si Beaumont <beaumont@apple.com>

* fixup: Port some test utils to not use NIOPosix

Signed-off-by: Si Beaumont <beaumont@apple.com>

* fixup: No swift-system, duh

Signed-off-by: Si Beaumont <beaumont@apple.com>

* fixup: read-write for temporary file in test helper

Signed-off-by: Si Beaumont <beaumont@apple.com>

Co-authored-by: Cory Benfield <lukasa@apple.com>
2022-05-04 08:14:18 -07:00