This commit is contained in:
Redkale
2020-06-26 00:38:24 +08:00
parent f88db8abf9
commit dcf0fecdb0
2 changed files with 1 additions and 2 deletions

View File

@@ -390,6 +390,7 @@ public class TcpNioAsyncConnection extends AsyncConnection {
totalCount += readCount;
}
if (totalCount != 0 || !hasRemain) {
if (readKey != null) readKey.interestOps(readKey.interestOps() & ~SelectionKey.OP_READ);
CompletionHandler<Integer, ByteBuffer> handler = this.readCompletionHandler;
ByteBuffer attach = this.readByteBuffer;
clearRead();
@@ -401,7 +402,6 @@ public class TcpNioAsyncConnection extends AsyncConnection {
this.workExecutor.execute(() -> handler.completed(totalCount0, attach));
}
}
if (readKey != null) readKey.interestOps(readKey.interestOps() & ~SelectionKey.OP_READ);
} else if (readKey == null) {
ioThread.register(selector -> {
try {

View File

@@ -68,7 +68,6 @@ public class NioThread extends Thread {
it.remove();
TcpNioAsyncConnection conn = (TcpNioAsyncConnection) key.attachment();
if (key.isWritable()) {
key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE);
conn.doWrite();
} else if (key.isReadable()) {
conn.doRead();