Changeset 6280


Ignore:
Timestamp:
Jul 2, 2008, 1:04:07 AM (13 years ago)
Author:
charles
Message:

#1069: Unknown seeders and leechers count in `Peers' tab

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r6229 r6280  
    457457{
    458458  int i;
     459  int seedCount = 0;
     460  int leechCount = 0;
    459461  int n_peers;
    460462  GtkTreeIter iter;
     
    491493  peers = tr_torrentPeers (tor, &n_peers);
    492494  qsort (peers, n_peers, sizeof(tr_peer_stat), compare_peers);
     495  for( i=0; i<n_peers; ++i ) {
     496    if( peers[i].progress >= 1.0 )
     497      ++seedCount;
     498    else
     499      ++leechCount;
     500  }
    493501
    494502  i = 0;
     
    526534#endif
    527535
    528   fmtpeercount (p->seeders_lb, stat->seeders);
    529   fmtpeercount (p->leechers_lb, stat->leechers);
     536  /* use the tracker-supplied information if it's available;
     537   * otherwise, use the counts of connected peers as a fallback */
     538  fmtpeercount (p->seeders_lb, stat->seeders >= 0 ? stat->seeders : seedCount );
     539  fmtpeercount (p->leechers_lb, stat->leechers >= 0 ? stat->leechers : leechCount );
    530540  fmtpeercount (p->completed_lb, stat->timesCompleted );
    531541
Note: See TracChangeset for help on using the changeset viewer.