-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dissallow access and removal of Head and Tail ChannelHandlers #225
Conversation
a301bec
to
0468cc2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one small note.
} | ||
|
||
do { | ||
_ = try channel.pipeline.context(name: "head").wait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to look for these handlers by type, as we couldn't fix that by just removing their names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an extra assert for that
0468cc2
to
57f8d99
Compare
@Lukasa PTAL again |
Sources/NIO/ChannelPipeline.swift
Outdated
/// | ||
/// - parameters: | ||
/// - body: The predicate to execute per `ChannelHandlerContext` in the `ChannelPipeline`. | ||
/// -returns: The `ChannelHandlerContext` that matches or `nil` if non did. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should note that this returns the first ChannelHandlerContext
that matches, not the only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
57f8d99
to
d04ee22
Compare
Sources/NIO/ChannelPipeline.swift
Outdated
@@ -446,9 +446,16 @@ public final class ChannelPipeline: ChannelInvoker { | |||
return promise.futureResult | |||
} | |||
|
|||
/// Returns a `ChannelHandlerContext` which matches. | |||
/// | |||
/// This skips head and tail (as these are internal and should not be accessible by the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unbalanced parenthesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Motivation: The Head and Tail ChannelHandlers should not be accessible as these are implementation details of the ChannelPipeline and removal of these will even make the whole ChannelPipeline not work anymore. Modifications: - Make it impossible to access / removal the Head and Tail ChannelHandlers - Exclude the Head and Tail ChannelHandler from the debug String - Add unit tests. Result: More robust ChannelPipeline.
d04ee22
to
8824fe3
Compare
@Lukasa thanks for the review... |
Motivation:
The Head and Tail ChannelHandlers should not be accessible as these are implementation details of the ChannelPipeline and removal of these will even make the whole ChannelPipeline not work anymore.
Modifications:
Result:
More robust ChannelPipeline.