Пример #1
0
  public UploadStatus getState() {

    if (_torrent.getState() == TorrentState.STOPPED) {
      return UploadStatus.CANCELLED;
    }

    if (!_torrent.isActive()) {
      if (_torrent.isComplete() && _torrent.getRatio() > 1) {
        return UploadStatus.COMPLETE;
      }
      return UploadStatus.INTERRUPTED;
    }

    if (_torrent.isUploading()) return UploadStatus.UPLOADING;

    if (_torrent.isSuspended()) return UploadStatus.SUSPENDED;

    // neither uploading, nor suspended..
    return UploadStatus.WAITING_REQUESTS;
  }