Do not auto-start read operation

This commit is contained in:
Trustin Lee 2013-01-03 16:01:41 +09:00
parent 103edc4467
commit 923dde7a5f
3 changed files with 2 additions and 10 deletions

View File

@ -153,7 +153,6 @@ public final class NioDatagramChannel
@Override
protected void doBind(SocketAddress localAddress) throws Exception {
javaChannel().socket().bind(localAddress);
selectionKey().interestOps(SelectionKey.OP_READ);
}
@Override
@ -166,7 +165,6 @@ public final class NioDatagramChannel
boolean success = false;
try {
javaChannel().connect(remoteAddress);
selectionKey().interestOps(selectionKey().interestOps() | SelectionKey.OP_READ);
success = true;
return true;
} finally {

View File

@ -211,9 +211,7 @@ public class NioSctpChannel extends AbstractNioMessageChannel implements io.nett
boolean success = false;
try {
boolean connected = javaChannel().connect(remoteAddress);
if (connected) {
selectionKey().interestOps(SelectionKey.OP_READ);
} else {
if (!connected) {
selectionKey().interestOps(SelectionKey.OP_CONNECT);
}
success = true;
@ -230,7 +228,6 @@ public class NioSctpChannel extends AbstractNioMessageChannel implements io.nett
if (!javaChannel().finishConnect()) {
throw new Error();
}
selectionKey().interestOps(SelectionKey.OP_READ);
}
@Override

View File

@ -174,9 +174,7 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty
boolean success = false;
try {
boolean connected = javaChannel().connect(remoteAddress);
if (connected) {
selectionKey().interestOps(SelectionKey.OP_READ);
} else {
if (!connected) {
selectionKey().interestOps(SelectionKey.OP_CONNECT);
}
success = true;
@ -193,7 +191,6 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty
if (!javaChannel().finishConnect()) {
throw new Error();
}
selectionKey().interestOps(SelectionKey.OP_READ);
}
@Override