Skip to content

Commit

Permalink
fix #323 When received the last HTTP packet but still sending the req…
Browse files Browse the repository at this point in the history
…uest, force the channel close

As the onHandlerTerminate will be invoked and it will remove the ChannelOperations from the
channel attributes, when the onOutboundComplete is invoked while checking for websocket
the implementation needs to take into account that the ChannelOperations might be removed already.
This is related to issue #342
  • Loading branch information
violetagg committed May 1, 2018
1 parent ac103c0 commit 4a2e773
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import reactor.ipc.netty.NettyContext;
import reactor.ipc.netty.NettyOutbound;
import reactor.ipc.netty.NettyPipeline;
import reactor.ipc.netty.channel.ChannelOperations;
import reactor.ipc.netty.channel.ContextHandler;
import reactor.ipc.netty.http.Cookies;
import reactor.ipc.netty.http.HttpOperations;
Expand Down Expand Up @@ -322,8 +323,8 @@ public boolean isKeepAlive() {

@Override
public boolean isWebsocket() {
return get(channel()).getClass()
.equals(HttpClientWSOperations.class);
ChannelOperations<?, ?> ops = get(channel());
return ops != null && ops.getClass().equals(HttpClientWSOperations.class);
}

@Override
Expand Down Expand Up @@ -594,6 +595,9 @@ protected void onInboundNext(ChannelHandlerContext ctx, Object msg) {
}
//force auto read to enable more accurate close selection now inbound is done
channel().config().setAutoRead(true);
if (markSentBody()) {
markPersistent(false);
}
onHandlerTerminate();
return;
}
Expand Down

0 comments on commit 4a2e773

Please sign in to comment.