Fire ChannelConnected events in a Worker Thread. See NETTY-439

This commit is contained in:
norman 2011-10-21 18:04:18 +02:00
parent 7328cfe58f
commit 783e7562c7
4 changed files with 10 additions and 2 deletions

View File

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

View File

@ -782,6 +782,11 @@ class NioWorker implements Runnable {
}
fireChannelConnected(channel, remoteAddress);
}
// Handle the channelConnected in the worker thread
if (channel instanceof NioAcceptedSocketChannel) {
fireChannelConnected(channel, channel.getRemoteAddress());
}
}
}
}

View File

@ -63,7 +63,6 @@ class OioAcceptedSocketChannel extends OioSocketChannel {
fireChannelOpen(this);
fireChannelBound(this, getLocalAddress());
fireChannelConnected(this, getRemoteAddress());
}
@Override

View File

@ -50,8 +50,13 @@ class OioWorker implements Runnable {
public void run() {
channel.workerThread = Thread.currentThread();
final PushbackInputStream in = channel.getInputStream();
boolean fireOpen = channel instanceof OioAcceptedSocketChannel;
while (channel.isOpen()) {
if (fireOpen) {
fireOpen = false;
fireChannelConnected(channel, channel.getRemoteAddress());
}
synchronized (channel.interestOpsLock) {
while (!channel.isReadable()) {
try {