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;
|
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 java.nio.channels.SocketChannel;
|
||||||
|
|
||||||
import org.jboss.netty.channel.Channel;
|
import org.jboss.netty.channel.Channel;
|
||||||
@ -44,5 +47,8 @@ final class NioAcceptedSocketChannel extends NioSocketChannel {
|
|||||||
this.bossThread = bossThread;
|
this.bossThread = bossThread;
|
||||||
|
|
||||||
setConnected();
|
setConnected();
|
||||||
|
|
||||||
|
fireChannelOpen(this);
|
||||||
|
fireChannelBound(this, getLocalAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -793,10 +793,8 @@ class NioWorker implements Runnable {
|
|||||||
fireChannelConnected(channel, remoteAddress);
|
fireChannelConnected(channel, remoteAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the channelOpen, channelBound and channelConnected in the worker thread
|
// Handle the channelConnected in the worker thread
|
||||||
if (channel instanceof NioAcceptedSocketChannel) {
|
if (channel instanceof NioAcceptedSocketChannel) {
|
||||||
fireChannelOpen(channel);
|
|
||||||
fireChannelBound(channel, channel.getLocalAddress());
|
|
||||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.netty.channel.socket.oio;
|
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.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PushbackInputStream;
|
import java.io.PushbackInputStream;
|
||||||
@ -58,6 +61,9 @@ class OioAcceptedSocketChannel extends OioSocketChannel {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ChannelException("Failed to obtain an OutputStream.", e);
|
throw new ChannelException("Failed to obtain an OutputStream.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fireChannelOpen(this);
|
||||||
|
fireChannelBound(this, getLocalAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,13 +50,11 @@ class OioWorker implements Runnable {
|
|||||||
channel.workerThread = Thread.currentThread();
|
channel.workerThread = Thread.currentThread();
|
||||||
final PushbackInputStream in = channel.getInputStream();
|
final PushbackInputStream in = channel.getInputStream();
|
||||||
|
|
||||||
boolean fireOpen = channel instanceof OioAcceptedSocketChannel;
|
boolean fireConnected = channel instanceof OioAcceptedSocketChannel;
|
||||||
|
|
||||||
while (channel.isOpen()) {
|
while (channel.isOpen()) {
|
||||||
if (fireOpen) {
|
if (fireConnected) {
|
||||||
fireOpen = false;
|
fireConnected = false;
|
||||||
fireChannelOpen(channel);
|
|
||||||
fireChannelBound(channel, channel.getLocalAddress());
|
|
||||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||||
}
|
}
|
||||||
synchronized (channel.interestOpsLock) {
|
synchronized (channel.interestOpsLock) {
|
||||||
|
Loading…
Reference in New Issue
Block a user