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.
This commit is contained in:
Cory Benfield 2018-05-30 14:35:10 +01:00 committed by GitHub
parent 402883a603
commit 695afc5205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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()