mirror of
https://github.com/apple/swift-nio
synced 2026-11-26 04:57:49 +00:00
Motivation: @vlm hit an interesting situation which is very likely the sign of another bug that we have yet to find: During a close, @vlm hit an error in close which lead to a user callout which then closed again. The immediate fix is simple (this PR) is as always not to call out to the user before reconciling our own state. But hitting this bug also means that either a `socket.close` or a `selectableEventLoop.deregister` failed as we only called out in those situations. That definitely hides a condition that is hard to imagine without another bug that we still need to find. Modifications: in `BaseSocketChannel.close0` follow rule 0 and don't call out before reconciling state. Result: fewer crashes, less potential to hide other bugs.