Only handle the channelConnected in the worker thread. The channelOpen
and channelBound was moved back to the boss thread. This was done after reading NETTY-154
This commit is contained in:
parent
cb2e047f1d
commit
fb408778d1
@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.jboss.netty.channel.socket.nio;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.fireChannelBound;
|
||||
import static org.jboss.netty.channel.Channels.fireChannelOpen;
|
||||
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import org.jboss.netty.channel.Channel;
|
||||
@ -44,5 +47,8 @@ final class NioAcceptedSocketChannel extends NioSocketChannel {
|
||||
this.bossThread = bossThread;
|
||||
|
||||
setConnected();
|
||||
|
||||
fireChannelOpen(this);
|
||||
fireChannelBound(this, getLocalAddress());
|
||||
}
|
||||
}
|
||||
|
@ -793,10 +793,8 @@ class NioWorker implements Runnable {
|
||||
fireChannelConnected(channel, remoteAddress);
|
||||
}
|
||||
|
||||
// Handle the channelOpen, channelBound and channelConnected in the worker thread
|
||||
// Handle the channelConnected in the worker thread
|
||||
if (channel instanceof NioAcceptedSocketChannel) {
|
||||
fireChannelOpen(channel);
|
||||
fireChannelBound(channel, channel.getLocalAddress());
|
||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.jboss.netty.channel.socket.oio;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.fireChannelBound;
|
||||
import static org.jboss.netty.channel.Channels.fireChannelOpen;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PushbackInputStream;
|
||||
@ -58,6 +61,9 @@ class OioAcceptedSocketChannel extends OioSocketChannel {
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException("Failed to obtain an OutputStream.", e);
|
||||
}
|
||||
|
||||
fireChannelOpen(this);
|
||||
fireChannelBound(this, getLocalAddress());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,13 +50,11 @@ class OioWorker implements Runnable {
|
||||
channel.workerThread = Thread.currentThread();
|
||||
final PushbackInputStream in = channel.getInputStream();
|
||||
|
||||
boolean fireOpen = channel instanceof OioAcceptedSocketChannel;
|
||||
boolean fireConnected = channel instanceof OioAcceptedSocketChannel;
|
||||
|
||||
while (channel.isOpen()) {
|
||||
if (fireOpen) {
|
||||
fireOpen = false;
|
||||
fireChannelOpen(channel);
|
||||
fireChannelBound(channel, channel.getLocalAddress());
|
||||
if (fireConnected) {
|
||||
fireConnected = false;
|
||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||
}
|
||||
synchronized (channel.interestOpsLock) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user