mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
* fix double remove of handlers Motivation: Previously, it was possible that a handler was removed twice: Once by Channel teardown and another time by a user-trigger removal that wasn't instantaneous. This racy situation can happen in the real world. NIO behaved wrongly in two ways: 1. we would call `handlerRemoved` twiced 2. ByteToMessageHandler would fail an assertion about the current removal state Modifications: - Only call `handlerRemoved` when the handler actually gets removed. - Fix the assertion. Result: fewer bugs * Update Sources/NIO/ChannelPipeline.swift Co-Authored-By: Cory Benfield <lukasa@apple.com>