From 695afc5205aaa49fca092b94b479ff71c43d9d3c Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Wed, 30 May 2018 14:35:10 +0100 Subject: [PATCH] Widen assertion on readEOF. (#453) Motivation: In Darwin it is possible for readEOF to be received before writable, if we race connection teardown with registering for writable. See https://github.com/apple/swift-nio/issues/452 for a more in-depth explanation. Modifications: Widened the assertion. Result: People's code won't go bang. --- Sources/NIO/BaseSocketChannel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/NIO/BaseSocketChannel.swift b/Sources/NIO/BaseSocketChannel.swift index bd7bcdf6a..e025691b3 100644 --- a/Sources/NIO/BaseSocketChannel.swift +++ b/Sources/NIO/BaseSocketChannel.swift @@ -865,8 +865,8 @@ class BaseSocketChannel: SelectableChannel, ChannelCore { // we can't be not active but still registered here; this would mean that we got a notification about a // channel before we're ready to receive them. - assert(self.lifecycleManager.isActive || !self.lifecycleManager.isPreRegistered, - "illegal state: \(self): active: \(self.lifecycleManager.isActive), pre-registered: \(self.lifecycleManager.isPreRegistered)") + assert(self.lifecycleManager.isRegisteredFully, + "illegal state: \(self): active: \(self.lifecycleManager.isActive), registered: \(self.lifecycleManager.isRegisteredFully)") self.readEOF0()