Skip to content

Commit

Permalink
修正重连时间溢出为负数的问题 hengyunabc#4
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Mar 24, 2016
1 parent d0a34e1 commit 9e7395b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ void channelUnregistered(final ChannelHandlerContext ctx) {

int currentRetryInterval = retryIntervalSeconds;
if (bBackOffRetryInterval) {
currentRetryInterval = retryIntervalSeconds * (1 << currentRetryTimes);
// 注意currentRetryInterval 可能会溢出
currentRetryInterval = retryIntervalSeconds * (currentRetryTimes >= 30 ? 1 << 30 : 1 << currentRetryTimes);
if (currentRetryInterval <= 0) {
currentRetryInterval = maxRetryIntervalSeconds;
}
}
if (currentRetryInterval > maxRetryIntervalSeconds) {
currentRetryInterval = maxRetryIntervalSeconds;
Expand Down

0 comments on commit 9e7395b

Please sign in to comment.