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
4fb585965c
commit
e3bf679998
@ -500,6 +500,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()) {
|
||||
@ -509,12 +512,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