NETTY-439 Call channelBound/Connected from worker

* Move channelBound() to RegisterTask
* Simplify the if block in RegisterTask
This commit is contained in:
Trustin Lee 2011-10-21 15:36:06 -07:00
parent beadadecf7
commit 4b9b421af2
2 changed files with 3 additions and 12 deletions

View File

@ -49,6 +49,5 @@ final class NioAcceptedSocketChannel extends NioSocketChannel {
setConnected(); setConnected();
fireChannelOpen(this); fireChannelOpen(this);
fireChannelBound(this, getLocalAddress());
} }
} }

View File

@ -786,18 +786,10 @@ class NioWorker implements Runnable {
} }
} }
if (!server) { if (server || !((NioClientSocketChannel) channel).boundManually) {
if (!((NioClientSocketChannel) channel).boundManually) {
fireChannelBound(channel, localAddress); fireChannelBound(channel, localAddress);
} }
fireChannelConnected(channel, remoteAddress); fireChannelConnected(channel, remoteAddress);
} }
// Handle the channelConnected in the worker thread
if (channel instanceof NioAcceptedSocketChannel) {
fireChannelConnected(channel, channel.getRemoteAddress());
}
}
} }
} }