[#3066] EpollDatagramChannel never calls fireChannelActive() after connect()

Motivation:

EpollDragramChannel never calls fireChannelActive after connect() which is a bug.

Modifications:

Correctly call fireChannelActive if needed

Result:

Correct behaviour
This commit is contained in:
Norman Maurer 2015-02-27 21:18:12 +01:00
parent 11f2951885
commit 3ac08a07af

View File

@ -481,6 +481,7 @@ public final class EpollDatagramChannel extends AbstractEpollChannel implements
boolean success = false;
try {
try {
boolean wasActive = isActive();
InetSocketAddress remoteAddress = (InetSocketAddress) remote;
if (local != null) {
InetSocketAddress localAddress = (InetSocketAddress) local;
@ -491,6 +492,12 @@ public final class EpollDatagramChannel extends AbstractEpollChannel implements
EpollDatagramChannel.this.remote = remoteAddress;
EpollDatagramChannel.this.local = Native.localAddress(fd().intValue());
success = true;
// Regardless if the connection attempt was cancelled, channelActive() event should be triggered,
// because what happened is what happened.
if (!wasActive && isActive()) {
pipeline().fireChannelActive();
}
} finally {
if (!success) {
doClose();