Skip to content

Commit

Permalink
[xuxueli#50] XXL RST ERROR xuxueli#50
Browse files Browse the repository at this point in the history
  • Loading branch information
gezhiwei committed Mar 31, 2023
1 parent eeaa1bd commit 74b2588
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.timeout.IdleStateEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

/**
* netty_http
*
Expand All @@ -40,6 +43,14 @@ protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse msg) thr
throw new XxlRpcException("xxl-rpc response status invalid.");
}

HttpHeaders headers = msg.headers();
String connection = headers.get("connection");
if (Objects.equals("close", connection)) {
logger.warn(">>>>>>>>>>> xxl-rpc netty_http client received close");
ctx.close();
return;
}

// response parse
byte[] responseBytes = ByteBufUtil.getBytes(msg.content());

Expand Down

0 comments on commit 74b2588

Please # to comment.