ChannelPipeline: addHandler and removeHandler instead of add/remove (#817)

Motivation:

- `ChannelPipeline.add(name:handler:...)` had a strange order of arguments
- `remove(handler:)` and `remove(ctx:)` both remove `ChannelHandler`s
  but they read like they remove different things

So let's just fix the argument order and name them `addHandler` and
`removeHandler` making clear what they do.

Modifications:

- rename all `ChannelPipeline.add(name:handler:...)`s to `ChannelPipeline.addHandler(_:name:...)`
- rename all `ChannelPipeline.remove(...)`s to `ChannelPipeline.removeHandler(...)`

Result:

more readable and consistent code
This commit is contained in:
Johannes Weiss authored and GitHub committed 2019-02-21 11:46:54 +00:00
1 parent 5d27e59bd9
commit 46ffd630de
50 files changed
+539 -425

No files matched your search

@@ -114,7 +114,7 @@ class HTTPServerProtocolErrorHandlerTest: XCTestCase {
}
let channel = EmbeddedChannel()
XCTAssertNoThrow(try channel.pipeline.configureHTTPServerPipeline(withErrorHandling: true).flatMap {
channel.pipeline.add(handler: DelayWriteHandler())
channel.pipeline.addHandler(DelayWriteHandler())
}.wait())
var buffer = channel.allocator.buffer(capacity: 1024)