forked from apple/swift-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NIOSingleStepByteToMessageDecoder reentrancy safety (apple#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.
- Loading branch information
1 parent
700e671
commit 52bdc08
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters