Changeset 217 for trunk/libtransmission


Ignore:
Timestamp:
Apr 7, 2006, 8:17:40 PM (16 years ago)
Author:
titer
Message:

Should fix a race condition

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r216 r217  
    668668}
    669669
    670 int tr_trackerSeeders( tr_torrent_t * tor)
    671 {
    672         if (tor->status != TR_STATUS_PAUSE)
    673         {
    674                 return (tor->tracker)->seeders;
    675         }
    676         return 0;
    677 }
    678 
    679 int tr_trackerLeechers( tr_torrent_t * tor)
    680 {
    681         if (tor->status != TR_STATUS_PAUSE)
    682         {
    683                 return (tor->tracker)->leechers;
    684         }
    685         return 0;
    686 }
     670int tr_trackerSeeders( tr_tracker_t * tc )
     671{
     672    if( !tc )
     673    {
     674        return -1;
     675    }
     676    return tc->seeders;
     677}
     678
     679int tr_trackerLeechers( tr_tracker_t * tc )
     680{
     681    if( !tc )
     682    {
     683        return -1;
     684    }
     685    return tc->leechers;
     686}
  • trunk/libtransmission/tracker.h

    r162 r217  
    3838 * Looks for the seeders/leechers as returned by the tracker.
    3939 **********************************************************************/
    40 int                         tr_trackerSeeders  ( tr_torrent_t * );
     40int                         tr_trackerSeeders  ( tr_tracker_t * );
    4141
    4242/***********************************************************************
     
    4545 * Looks for the seeders/leechers as returned by the tracker.
    4646 **********************************************************************/
    47 int                         tr_trackerLeechers ( tr_torrent_t * );
     47int                         tr_trackerLeechers ( tr_tracker_t * );
    4848
    4949int            tr_trackerScrape    ( tr_torrent_t *, int *, int * );
  • trunk/libtransmission/transmission.c

    r216 r217  
    332332
    333333    tr_trackerClose( tor->tracker );
     334    tor->tracker = NULL;
    334335
    335336    while( tor->peerCount > 0 )
     
    423424    s->rateUpload = tr_rcRate( tor->upload );
    424425   
    425     s->seeders    = tr_trackerSeeders(tor);
    426         s->leechers       = tr_trackerLeechers(tor);
     426    s->seeders  = tr_trackerSeeders(tor->tracker);
     427        s->leechers = tr_trackerLeechers(tor->tracker);
    427428
    428429    if( s->rateDownload < 0.1 )
Note: See TracChangeset for help on using the changeset viewer.