Fix an unexpected IllegalStateException from a selector loop when a user cancels a connection attempt

- Fixes #1986
This commit is contained in:
Trustin Lee 2013-11-18 16:32:52 +09:00
parent 786fdbd6e0
commit 38f57adb70

View File

@ -237,7 +237,8 @@ public abstract class AbstractNioChannel extends AbstractChannel {
t = newT; t = newT;
} }
connectPromise.setFailure(t); // Use tryFailure() instead of setFailure() to avoid the race against cancel().
connectPromise.tryFailure(t);
closeIfClosed(); closeIfClosed();
} finally { } finally {
// Check for null as the connectTimeoutFuture is only created if a connectTimeoutMillis > 0 is used // Check for null as the connectTimeoutFuture is only created if a connectTimeoutMillis > 0 is used