Fire ChannelConnected events in a Worker Thread. See NETTY-439
This commit is contained in:
parent
7328cfe58f
commit
783e7562c7
@ -48,6 +48,5 @@ final class NioAcceptedSocketChannel extends NioSocketChannel {
|
||||
setConnected();
|
||||
fireChannelOpen(this);
|
||||
fireChannelBound(this, getLocalAddress());
|
||||
fireChannelConnected(this, getRemoteAddress());
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ class OioAcceptedSocketChannel extends OioSocketChannel {
|
||||
|
||||
fireChannelOpen(this);
|
||||
fireChannelBound(this, getLocalAddress());
|
||||
fireChannelConnected(this, getRemoteAddress());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user