[#907] Stop flush if one outboundbuffer was freed and do the same for inboundBufferUpdated if an inboundbuffer was freed
This commit is contained in:
parent
cfa300f431
commit
4dd462d0b5
@ -1084,7 +1084,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
pipeline.notifyHandlerException(t);
|
pipeline.notifyHandlerException(t);
|
||||||
} finally {
|
} finally {
|
||||||
if (handler instanceof ChannelInboundByteHandler && !inboundByteBuffer().isFreed()) {
|
if (handler instanceof ChannelInboundByteHandler && !isInboundBufferFreed()) {
|
||||||
try {
|
try {
|
||||||
((ChannelInboundByteHandler) handler).discardInboundReadBytes(this);
|
((ChannelInboundByteHandler) handler).discardInboundReadBytes(this);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -1424,7 +1424,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
pipeline.notifyHandlerException(t);
|
pipeline.notifyHandlerException(t);
|
||||||
} finally {
|
} finally {
|
||||||
if (handler instanceof ChannelOutboundByteHandler) {
|
if (handler instanceof ChannelOutboundByteHandler && !isOutboundBufferFreed()) {
|
||||||
try {
|
try {
|
||||||
((ChannelOutboundByteHandler) handler).discardOutboundReadBytes(this);
|
((ChannelOutboundByteHandler) handler).discardOutboundReadBytes(this);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -1559,6 +1559,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
void invokeFreeInboundBuffer() {
|
void invokeFreeInboundBuffer() {
|
||||||
|
pipeline.inboundBufferFreed = true;
|
||||||
EventExecutor executor = executor();
|
EventExecutor executor = executor();
|
||||||
if (prev != null && executor.inEventLoop()) {
|
if (prev != null && executor.inEventLoop()) {
|
||||||
invokeFreeInboundBuffer0();
|
invokeFreeInboundBuffer0();
|
||||||
@ -1598,6 +1599,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
|
|
||||||
/** Invocation initiated by {@link #invokeFreeInboundBuffer0()} after freeing all inbound buffers. */
|
/** Invocation initiated by {@link #invokeFreeInboundBuffer0()} after freeing all inbound buffers. */
|
||||||
private void invokeFreeOutboundBuffer() {
|
private void invokeFreeOutboundBuffer() {
|
||||||
|
pipeline.outboundBufferFreed = true;
|
||||||
EventExecutor executor = executor();
|
EventExecutor executor = executor();
|
||||||
if (executor.inEventLoop()) {
|
if (executor.inEventLoop()) {
|
||||||
invokeFreeOutboundBuffer0();
|
invokeFreeOutboundBuffer0();
|
||||||
@ -1648,23 +1650,11 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInboundBufferFreed() {
|
private boolean isInboundBufferFreed() {
|
||||||
if (hasInboundByteBuffer()) {
|
return pipeline.inboundBufferFreed;
|
||||||
return inboundByteBuffer().isFreed();
|
|
||||||
}
|
|
||||||
if (hasInboundMessageBuffer()) {
|
|
||||||
return inboundMessageBuffer().isFreed();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isOutboundBufferFreed() {
|
private boolean isOutboundBufferFreed() {
|
||||||
if (hasOutboundByteBuffer()) {
|
return pipeline.outboundBufferFreed;
|
||||||
return outboundByteBuffer().isFreed();
|
|
||||||
}
|
|
||||||
if (hasOutboundMessageBuffer()) {
|
|
||||||
return outboundMessageBuffer().isFreed();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateFuture(ChannelFuture future) {
|
private void validateFuture(ChannelFuture future) {
|
||||||
|
@ -57,6 +57,8 @@ final class DefaultChannelPipeline implements ChannelPipeline {
|
|||||||
new IdentityHashMap<EventExecutorGroup, EventExecutor>();
|
new IdentityHashMap<EventExecutorGroup, EventExecutor>();
|
||||||
|
|
||||||
private static final TailHandler TAIL_HANDLER = new TailHandler();
|
private static final TailHandler TAIL_HANDLER = new TailHandler();
|
||||||
|
volatile boolean inboundBufferFreed;
|
||||||
|
volatile boolean outboundBufferFreed;
|
||||||
|
|
||||||
public DefaultChannelPipeline(Channel channel) {
|
public DefaultChannelPipeline(Channel channel) {
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user