Fix a bug where ChannelOutboundBuffer.removeBytes() throws ClassCastException
When a ChannelOutboundBuffer contains ByteBufs followed by a FileRegion, removeBytes() will fail with a ClassCastException. It should break the loop instead.
This commit is contained in:
parent
23d15c71ee
commit
44d9163169
@ -304,11 +304,13 @@ public final class ChannelOutboundBuffer {
|
|||||||
*/
|
*/
|
||||||
public void removeBytes(long writtenBytes) {
|
public void removeBytes(long writtenBytes) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
final ByteBuf buf = (ByteBuf) current();
|
Object msg = current();
|
||||||
if (buf == null) {
|
if (!(msg instanceof ByteBuf)) {
|
||||||
|
assert writtenBytes == 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final ByteBuf buf = (ByteBuf) msg;
|
||||||
final int readerIndex = buf.readerIndex();
|
final int readerIndex = buf.readerIndex();
|
||||||
final int readableBytes = buf.writerIndex() - readerIndex;
|
final int readableBytes = buf.writerIndex() - readerIndex;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user