Call discardReadBytes() on outbound byte buffers when possible
- Also fixed a test failure in codec-http
This commit is contained in:
parent
d626561b59
commit
f2eddda5a4
@ -626,6 +626,9 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
|
|||||||
cause = t;
|
cause = t;
|
||||||
} finally {
|
} finally {
|
||||||
writeCounter += oldSize - out.size();
|
writeCounter += oldSize - out.size();
|
||||||
|
if (out.isEmpty() && out.hasByteBuffer()) {
|
||||||
|
out.byteBuffer().discardReadBytes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cause == null) {
|
if (cause == null) {
|
||||||
|
@ -323,7 +323,7 @@ public class DefaultChannelFuture extends FlushCheckpoint implements ChannelFutu
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkDeadLock() {
|
private void checkDeadLock() {
|
||||||
if (channel().eventLoop().inEventLoop()) {
|
if (channel().isRegistered() && channel().eventLoop().inEventLoop()) {
|
||||||
throw new BlockingOperationException();
|
throw new BlockingOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -927,6 +927,11 @@ public class DefaultChannelPipeline implements ChannelPipeline {
|
|||||||
((ChannelOutboundHandler<Object>) ctx.handler()).flush(ctx, future);
|
((ChannelOutboundHandler<Object>) ctx.handler()).flush(ctx, future);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
notifyHandlerException(t);
|
notifyHandlerException(t);
|
||||||
|
} finally {
|
||||||
|
ChannelBufferHolder<Object> outbound = ctx.outbound();
|
||||||
|
if (!outbound.isBypass() && outbound.isEmpty() && outbound.hasByteBuffer()) {
|
||||||
|
outbound.byteBuffer().discardReadBytes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
channel().unsafe().flush(future);
|
channel().unsafe().flush(future);
|
||||||
|
Loading…
Reference in New Issue
Block a user