Ensure connect promise is notifed before fireChannelActive() is called. Related to [#4927]
Motivation: We should always first notify the promise before trigger an event through the pipeline to be consistent. Modifications: Ensure we notify the promise before fire event. Result: Consistent behavior
This commit is contained in:
parent
c8b2633864
commit
0a959efc9e
@ -502,6 +502,9 @@ public final class EpollDatagramChannel extends AbstractEpollChannel implements
|
||||
EpollDatagramChannel.this.local = fd().localAddress();
|
||||
success = true;
|
||||
|
||||
// First notify the promise before notifying the handler.
|
||||
channelPromise.trySuccess();
|
||||
|
||||
// Regardless if the connection attempt was cancelled, channelActive() event should be triggered,
|
||||
// because what happened is what happened.
|
||||
if (!wasActive && isActive()) {
|
||||
@ -511,12 +514,11 @@ public final class EpollDatagramChannel extends AbstractEpollChannel implements
|
||||
if (!success) {
|
||||
doClose();
|
||||
} else {
|
||||
channelPromise.setSuccess();
|
||||
connected = true;
|
||||
}
|
||||
}
|
||||
} catch (Throwable cause) {
|
||||
channelPromise.setFailure(cause);
|
||||
channelPromise.tryFailure(cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user