Fix potential NPE / Use discardReadBytes instead of clear()
This commit is contained in:
parent
c77f107f5f
commit
e7c6ca945f
@ -37,7 +37,7 @@ abstract class AioCompletionHandler<V, A extends Channel> implements CompletionH
|
|||||||
*/
|
*/
|
||||||
protected abstract void failed0(Throwable exc, A channel);
|
protected abstract void failed0(Throwable exc, A channel);
|
||||||
|
|
||||||
private static final int MAX_STACK_DEPTH = 4;
|
private static final int MAX_STACK_DEPTH = Integer.MAX_VALUE;
|
||||||
private static final ThreadLocal<Integer> STACK_DEPTH = new ThreadLocal<Integer>() {
|
private static final ThreadLocal<Integer> STACK_DEPTH = new ThreadLocal<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
protected Integer initialValue() {
|
protected Integer initialValue() {
|
||||||
|
@ -190,7 +190,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
// Reset reader/writerIndex to 0 if the buffer is empty.
|
// Reset reader/writerIndex to 0 if the buffer is empty.
|
||||||
buf.clear();
|
buf.discardReadBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.notifyFlushFutures(writtenBytes);
|
channel.notifyFlushFutures(writtenBytes);
|
||||||
@ -274,7 +274,6 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
channel.unsafe().close(channel.unsafe().voidFuture());
|
channel.unsafe().close(channel.unsafe().voidFuture());
|
||||||
} else {
|
} else {
|
||||||
// start the next read
|
// start the next read
|
||||||
//channel.readTask.run();
|
|
||||||
channel.eventLoop().execute(channel.readTask);
|
channel.eventLoop().execute(channel.readTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user