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 b5a587fadf
commit 54d3c99469

View File

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