mirror of
https://github.com/apple/swift-nio
synced 2026-11-29 05:24:21 +00:00
Motivation: Currently we only supporting adding channel handlers at the front or the end of the pipeline. This is potentially a bit frustrating: it becomes impossible to insert handlers relative to a specific point in the pipeline, which limits users ability to code generic pipeline modification operations. Modifications: Added two new methods to ChannelPipeline, specifically add(handler:before:) and add(handler:after:). Also performed a substantial internal refactoring of the ChannelPipeline handler adding code to ensure that all operations go through the same logical path, redefining add(handler:first:) in terms of adding either before tail or after head. Result: Users will be able to insert channel handlers at any point in a ChannelPipeline, so long as they are able to point at a handler already in that pipeline.