Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dongliu committed Jul 12, 2018
1 parent 1a6159d commit 3ab6877
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
message.setResponseBody(responseHeaders.createBody());
if (headersEvent.endOfStream()) {
message.responseBody().finish();
messageMap.remove(streamId);
}
} else {
logger.error("message for stream id {} not found", streamId);
Expand All @@ -114,6 +115,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
body.append(dataEvent.data().nioBuffer());
if (dataEvent.endOfStream()) {
body.finish();
messageMap.remove(streamId);
}
} else {
logger.error("message for stream id {} not found", streamId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class SSLDetector extends ChannelInboundHandlerAdapter {
private ByteBuf buf;
private boolean isSSL;
private Queue<ByteBuf> queue;
private boolean removed;

private final NetAddress address;
private final MessageListener messageListener;
Expand Down Expand Up @@ -123,7 +124,10 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
ctx.close();
}
});
ctx.pipeline().remove(SSLDetector.this);
if (!removed) {
ctx.pipeline().remove(SSLDetector.this);
removed = true;
}
}
});
}
Expand Down Expand Up @@ -162,6 +166,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {

@Override
public void handlerRemoved(ChannelHandlerContext ctx) {
removed = true;
if (buf != null) {
ctx.fireChannelRead(buf);
}
Expand Down

0 comments on commit 3ab6877

Please sign in to comment.