Skip to content

Commit

Permalink
Merge pull request #431 from tronprotocol/p2p_msg_queue
Browse files Browse the repository at this point in the history
modify P2pHandler and message queue
  • Loading branch information
zhaohong authored Apr 13, 2018
2 parents c5b5452 + 5240b3f commit 0573941
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void sendToWire(MessageRoundtrip messageRoundtrip) {

if (messageRoundtrip.getRetryTimes() > 0){
logger.warn("send msg timeout. close channel {}.", ctx.channel().remoteAddress());
ctx.close();
close();
return;
}

Expand All @@ -193,6 +193,11 @@ private void sendToWire(MessageRoundtrip messageRoundtrip) {

public void close() {
sendMsgThread.interrupt();
timerTask.cancel(false);
timerTask.cancel(true);
if (ctx != null){
ctx.close();
ctx = null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E

public void closeChannel(ChannelHandlerContext ctx) {
ctx.close();
pingTask.cancel(false);
pingTask.cancel(true);
msgQueue.close();
}

Expand Down

0 comments on commit 0573941

Please sign in to comment.