修复WriteMoreCompletionHandler的bug

This commit is contained in:
Redkale
2019-11-30 11:14:44 +08:00
parent 131855cdc5
commit bed81bd93d

View File

@@ -300,16 +300,16 @@ public class TcpAioAsyncConnection extends AsyncConnection {
if (result >= 0) {
writeCount += result;
try {
int index = -1;
int incre = -1;
for (int i = writeOffset; i < (writeOffset + writeLength); i++) {
if (writeBuffers[i].hasRemaining()) {
index = i;
incre = i - writeOffset;
break;
}
}
if (index >= 0) {
writeOffset += index;
writeLength -= index;
if (incre >= 0) {
writeOffset += incre;
writeLength -= incre;
channel.write(writeBuffers, writeOffset, writeLength, writeTimeoutSeconds > 0 ? writeTimeoutSeconds : 60, TimeUnit.SECONDS, attachment, this);
return;
}