Fix potential NPE / Use discardReadBytes instead of clear()

This commit is contained in:
Trustin Lee 2012-07-08 22:22:35 +09:00
parent c77f107f5f
commit e7c6ca945f
2 changed files with 2 additions and 3 deletions

View File

@ -37,7 +37,7 @@ abstract class AioCompletionHandler<V, A extends Channel> implements CompletionH
*/
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>() {
@Override
protected Integer initialValue() {

View File

@ -190,7 +190,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
if (empty) {
// Reset reader/writerIndex to 0 if the buffer is empty.
buf.clear();
buf.discardReadBytes();
}
channel.notifyFlushFutures(writtenBytes);
@ -274,7 +274,6 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
channel.unsafe().close(channel.unsafe().voidFuture());
} else {
// start the next read
//channel.readTask.run();
channel.eventLoop().execute(channel.readTask);
}
}