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();
|
setConnected();
|
||||||
fireChannelOpen(this);
|
fireChannelOpen(this);
|
||||||
fireChannelBound(this, getLocalAddress());
|
fireChannelBound(this, getLocalAddress());
|
||||||
fireChannelConnected(this, getRemoteAddress());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,6 +782,11 @@ class NioWorker implements Runnable {
|
|||||||
}
|
}
|
||||||
fireChannelConnected(channel, remoteAddress);
|
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);
|
fireChannelOpen(this);
|
||||||
fireChannelBound(this, getLocalAddress());
|
fireChannelBound(this, getLocalAddress());
|
||||||
fireChannelConnected(this, getRemoteAddress());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,8 +50,13 @@ class OioWorker implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
channel.workerThread = Thread.currentThread();
|
channel.workerThread = Thread.currentThread();
|
||||||
final PushbackInputStream in = channel.getInputStream();
|
final PushbackInputStream in = channel.getInputStream();
|
||||||
|
boolean fireOpen = channel instanceof OioAcceptedSocketChannel;
|
||||||
|
|
||||||
while (channel.isOpen()) {
|
while (channel.isOpen()) {
|
||||||
|
if (fireOpen) {
|
||||||
|
fireOpen = false;
|
||||||
|
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||||
|
}
|
||||||
synchronized (channel.interestOpsLock) {
|
synchronized (channel.interestOpsLock) {
|
||||||
while (!channel.isReadable()) {
|
while (!channel.isReadable()) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user