Skip to content

Commit

Permalink
检测分段下载异常时重新下载
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Mar 30, 2018
1 parent 9f64245 commit 35e5809
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
//真实响应字节小于要下载的字节,在下载完成后要继续下载
LOGGER.debug("继续下载:channelId[" + ctx.channel().id() + "]\t" + chunkInfo);
bootstrap.retryChunkDown(chunkInfo, HttpDownStatus.CONNECTING_CONTINUE);
} else if (chunkInfo.getDownSize() > chunkInfo.getTotalSize()) {
LOGGER.debug("分段下载异常:channelId[" + ctx.channel().id() + "]\t" + chunkInfo);
chunkInfo.setDownSize(0);
chunkInfo.setStartTime(System.currentTimeMillis());
chunkInfo.setNowStartPosition(chunkInfo.getOriStartPosition());
bootstrap.retryChunkDown(chunkInfo);
}
} else {
HttpResponse httpResponse = (HttpResponse) msg;
Expand Down

0 comments on commit 35e5809

Please sign in to comment.