mirror of
https://github.com/apple/swift-nio.git
synced 2026-05-20 20:30:36 +00:00
37ffc4b8d5
### Motivation: Channels based on `BaseSocketChannel` throw in both `getOption` and `setOption` if the channel has been closed, since the `setsockopt` will fail. However, the current behavior of `EmbeddedChannel` is options remain writable and readable on closed channels. There are situations where we'd like to be able to model the runtime behaviour of the real channel in tests, e.g. to test this fix: https://github.com/apple/swift-nio-extras/pull/304. ### Modifications: - Add API to enable throwing in `EmbeddedChannel.getOption` and `.setOption` if channel is closed. - Add a test for this new behavior. ### Result: - New API to enable throwing in `EmbeddedChannel.getOption` and `.setOption` if channel is closed. - No observable change for existing users of `EmbeddedChannel`.