Changeset 13896


Ignore:
Timestamp:
Jan 30, 2013, 12:20:51 AM (8 years ago)
Author:
jordan
Message:

when sorting by activity and both torrents' upload and download speed is zero, use how many peers we're ready to upload to / download from as a secondary key.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-core.c

    r13868 r13896  
    469469  int ret = 0;
    470470  tr_torrent *ta, *tb;
    471   const tr_stat *sa, *sb;
    472471  double aUp, aDown, bUp, bDown;
    473472
     
    480479                            MC_TORRENT, &tb,
    481480                            -1);
    482   sa = tr_torrentStatCached (ta);
    483   sb = tr_torrentStatCached (tb);
     481
     482  ret = compare_double (aUp+aDown, bUp+bDown);
    484483
    485484  if (!ret)
    486     ret = compare_double (aUp+aDown, bUp+bDown);
     485    {
     486      const tr_stat * const sa = tr_torrentStatCached (ta);
     487      const tr_stat * const sb = tr_torrentStatCached (tb);
     488      ret = compare_uint64 (sa->peersSendingToUs + sa->peersGettingFromUs,
     489                            sb->peersSendingToUs + sb->peersGettingFromUs);
     490    }
     491
    487492  if (!ret)
    488     ret = compare_uint64 (sa->uploadedEver, sb->uploadedEver);
    489   if (!ret)
    490     ret = compare_by_queue (m, a, b, user_data);
     493    ret = compare_by_activity (m, a, b, user_data);
    491494
    492495  return ret;
  • trunk/qt/torrent-filter.cc

    r13720 r13896  
    101101        case SortMode :: SORT_BY_ACTIVITY:
    102102            if( !val ) val = compare( a->downloadSpeed() + a->uploadSpeed(), b->downloadSpeed() + b->uploadSpeed() );
    103             if( !val ) val = compare( a->uploadedEver(), b->uploadedEver() );
     103            if( !val ) val = compare( a->peersWeAreUploadingTo() + a->webseedsWeAreDownloadingFrom(),
     104                                      b->peersWeAreUploadingTo() + b->webseedsWeAreDownloadingFrom());
    104105            // fall through
    105106        case SortMode :: SORT_BY_STATE:
    106             if( !val ) val = compare( a->hasError(), b->hasError() );
     107            if( !val ) val = -compare( a->isPaused(), b->isPaused() );
    107108            if( !val ) val = compare( a->getActivity(), b->getActivity() );
    108109            if( !val ) val = -compare( a->queuePosition(), b->queuePosition() );
     110            if( !val ) val = compare( a->hasError(), b->hasError() );
    109111            // fall through
    110112        case SortMode :: SORT_BY_PROGRESS:
Note: See TracChangeset for help on using the changeset viewer.