[#670] Intermittent IllegalStateException with ByteToMessageDecoder impl with bounded inbound buffer

* Ensure to call discardReadBytes() before giving up expanding the buffer
This commit is contained in:
Trustin Lee 2012-10-22 11:53:25 -07:00
parent d9d8acf331
commit ae839db383
2 changed files with 5 additions and 0 deletions

View File

@ -192,6 +192,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
final int maxCapacity = byteBuf.maxCapacity();
if (capacity == maxCapacity) {
byteBuf.discardReadBytes();
return;
}

View File

@ -141,6 +141,10 @@ abstract class AbstractNioByteChannel extends AbstractNioChannel {
final int maxCapacity = byteBuf.maxCapacity();
if (capacity == maxCapacity) {
if (byteBuf.readerIndex() != 0) {
byteBuf.discardReadBytes();
return 0;
}
return 2;
}