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.
Add new protocol for ChannelHandler to get buffered bytes in the chan…
…nel handler (apple#2918) Add new protocol to get buffered bytes from `ChannelHandler`s and `ChannelPipeline` API to query the buffered bytes from `ChannelHandler`s ### Motivation: In apple#2849, a new `ChannelOption` is introduced to retrieve the number of buffered outbound bytes in a `Channel`. However, this solution does not account for bytes that may be buffered within individual `ChannelHandler`s. This PR builds on apple#2849 by adding functionality to audit buffered bytes residing in `ChannelHandler`s and exposing this information through new `ChannelPipeline` APIs. ### Modifications: - Two new protocols for `ChannelHandler` to audit buffered bytes for inbound and outbound. - `NIOOutboundByteBufferingChannelHandler` - `NIOInboundByteBufferingChannelHandler` - New `ChannelPipeline` APIs - outboundBufferedBytes() - outboundBufferedBytes(in: ChannelHandlerContext) (only in `syncOperations`) - inboundBufferedBytes() - inboundBufferedBytes(in: ChannelHandlerContext) (only in `syncOperations`) ### Result: Users can now easily query the amount of bytes buffered in `ChannelHandler`s using the new `ChannelPipeline` APIs, enhancing the visibility of `ChannelHandler` performance. --------- Co-authored-by: Cory Benfield <[email protected]> (cherry picked from commit 9356598)
- Loading branch information
Showing
3 changed files
with
1,218 additions
and
0 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
Oops, something went wrong.