mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
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:
1 parent
5d27e59bd9
commit
46ffd630de
50 files changed
+539
-425
No files matched your search
@@ -46,7 +46,7 @@ let bootstrap = ClientBootstrap(group: group)
|
||||
// Enable SO_REUSEADDR.
|
||||
.channelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
|
||||
.channelInitializer { channel in
|
||||
channel.pipeline.add(handler: ChatHandler())
|
||||
channel.pipeline.addHandler(ChatHandler())
|
||||
}
|
||||
defer {
|
||||
try! group.syncShutdownGracefully()
|
||||
|
||||
Reference in new issue
Block a user