Skip to content

Commit 695afc5

Browse files
authored
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 #452 for a more in-depth explanation. Modifications: Widened the assertion. Result: People's code won't go bang.
1 parent 402883a commit 695afc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/NIO/BaseSocketChannel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,8 @@ class BaseSocketChannel<T: BaseSocket>: SelectableChannel, ChannelCore {
865865

866866
// we can't be not active but still registered here; this would mean that we got a notification about a
867867
// channel before we're ready to receive them.
868-
assert(self.lifecycleManager.isActive || !self.lifecycleManager.isPreRegistered,
869-
"illegal state: \(self): active: \(self.lifecycleManager.isActive), pre-registered: \(self.lifecycleManager.isPreRegistered)")
868+
assert(self.lifecycleManager.isRegisteredFully,
869+
"illegal state: \(self): active: \(self.lifecycleManager.isActive), registered: \(self.lifecycleManager.isRegisteredFully)")
870870

871871
self.readEOF0()
872872

0 commit comments

Comments
 (0)