Skip to content

Commit

Permalink
Widen assertion on readEOF. (#453)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lukasa committed May 30, 2018
1 parent 402883a commit 695afc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/NIO/BaseSocketChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,8 @@ class BaseSocketChannel<T: BaseSocket>: 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()

Expand Down

0 comments on commit 695afc5

Please sign in to comment.