private void reConnect(ConnectInfo connectInfo, boolean isHelp) {
    if (loopGroup == null) {
      return;
    }
    if (!isHelp && response.isSupportRange()) {
      connectInfo.setStartPosition(connectInfo.getStartPosition() + connectInfo.getDownSize());
    }
    connectInfo.setDownSize(0);
    if (connectInfo.getErrorCount() < downConfig.getRetryCount()) {
      connect(connectInfo);
    } else {
      if (callback != null) {
        callback.onChunkError(this, taskInfo.getChunkInfoList().get(connectInfo.getChunkIndex()));
      }
      if (taskInfo.getConnectInfoList().stream()
          .filter(connect -> connect.getStatus() != HttpDownStatus.DONE)
          .allMatch(connect -> connect.getErrorCount() >= downConfig.getRetryCount())) {
        taskInfo.setStatus(HttpDownStatus.ERROR);
        taskInfo.getChunkInfoList().stream()
            .filter(chunk -> chunk.getStatus() != HttpDownStatus.DONE)
            .forEach(chunkInfo -> chunkInfo.setStatus(HttpDownStatus.ERROR));
        close();
        if (callback != null) {
          callback.onError(this);
        }
      }
    }
  }
private void reConnect ( ConnectInfo connectInfo , boolean isHelp ) { if ( loopGroup == null ) { return ; } if ( ! isHelp && response . isSupportRange ( ) ) { connectInfo . setStartPosition ( connectInfo . getStartPosition ( ) + connectInfo . getDownSize ( ) ) ; } connectInfo . setDownSize ( 0 ) ; if ( connectInfo . getErrorCount ( ) < downConfig . getRetryCount ( ) ) { connect ( connectInfo ) ; } else { if ( callback != null ) { callback . onChunkError ( this , taskInfo . getChunkInfoList ( ) . get ( connectInfo . getChunkIndex ( ) ) ) ; } if ( taskInfo . getConnectInfoList ( ) . stream ( ) . filter ( connect -> connect . getStatus ( ) != HttpDownStatus . DONE ) . allMatch ( connect -> connect . getErrorCount ( ) >= downConfig . getRetryCount ( ) ) ) { taskInfo . setStatus ( HttpDownStatus . ERROR ) ; taskInfo . getChunkInfoList ( ) . stream ( ) . filter ( chunk -> chunk . getStatus ( ) != HttpDownStatus . DONE ) . forEach ( chunkInfo -> chunkInfo . setStatus ( HttpDownStatus . ERROR ) ) ; close ( ) ; if ( callback != null ) { callback . onError ( this ) ; } } } }
重新发起连接

@param connectInfo 连接相关信息
@param isHelp 是否为帮助其他分段下载发起的连接