diff --git a/Sources/NIO/ChannelOption.swift b/Sources/NIO/ChannelOption.swift index 8da153d891..c7cc8ad1cd 100644 --- a/Sources/NIO/ChannelOption.swift +++ b/Sources/NIO/ChannelOption.swift @@ -45,6 +45,13 @@ public struct SocketOption: ChannelOption, Equatable { self.level = level self.name = name } + + public static func == (lhs: SocketOption, rhs: SocketOption) -> Bool { + switch (lhs, rhs) { + case (.const(let lLevel, let lName), .const(let rLevel, let rName)): + return lLevel == rLevel && lName == rName + } + } } /// `AllocatorOption` allows to specify the `ByteBufferAllocator` to use. diff --git a/docs/public-api-changes-NIO1-to-NIO2.md b/docs/public-api-changes-NIO1-to-NIO2.md index f16eb058c9..e8786fe00a 100644 --- a/docs/public-api-changes-NIO1-to-NIO2.md +++ b/docs/public-api-changes-NIO1-to-NIO2.md @@ -63,3 +63,4 @@ - change `ChannelPipeline.addHandler[s](_:first:)` to `ChannelPipeline.addHandler(_:postion:)` where `position` can be `.first`, `.last`, `.before(ChannelHandler)`, and `.after(ChannelHandler)` - change `ChannelPipeline.addHandler(_:before:)` to `ChannelPipeline.addHandler(_:postion:)` where `position` can be `.first`, `.last`, `.before(ChannelHandler)`, and `.after(ChannelHandler)` - change `ChannelPipeline.addHandler(_:after:)` to `ChannelPipeline.addHandler(_:postion:)` where `position` can be `.first`, `.last`, `.before(ChannelHandler)`, and `.after(ChannelHandler)` +- all `ChannelOption`s are now required to be `Equatable`