1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-19 10:15:36 +00:00

Should fix a race condition

This commit is contained in:
Eric Petit 2006-04-07 20:17:40 +00:00
parent f256fa2cce
commit 7449c80d67
3 changed files with 17 additions and 16 deletions

View file

@ -667,20 +667,20 @@ int tr_trackerScrape( tr_torrent_t * tor, int * seeders, int * leechers )
return 0;
}
int tr_trackerSeeders( tr_torrent_t * tor)
int tr_trackerSeeders( tr_tracker_t * tc )
{
if (tor->status != TR_STATUS_PAUSE)
{
return (tor->tracker)->seeders;
}
return 0;
if( !tc )
{
return -1;
}
return tc->seeders;
}
int tr_trackerLeechers( tr_torrent_t * tor)
int tr_trackerLeechers( tr_tracker_t * tc )
{
if (tor->status != TR_STATUS_PAUSE)
{
return (tor->tracker)->leechers;
}
return 0;
if( !tc )
{
return -1;
}
return tc->leechers;
}

View file

@ -37,14 +37,14 @@ void tr_trackerClose ( tr_tracker_t * );
***********************************************************************
* Looks for the seeders/leechers as returned by the tracker.
**********************************************************************/
int tr_trackerSeeders ( tr_torrent_t * );
int tr_trackerSeeders ( tr_tracker_t * );
/***********************************************************************
* tr_trackerLeechers
***********************************************************************
* Looks for the seeders/leechers as returned by the tracker.
**********************************************************************/
int tr_trackerLeechers ( tr_torrent_t * );
int tr_trackerLeechers ( tr_tracker_t * );
int tr_trackerScrape ( tr_torrent_t *, int *, int * );

View file

@ -331,6 +331,7 @@ static void torrentReallyStop( tr_torrent_t * tor )
tr_dbg( "Thread joined" );
tr_trackerClose( tor->tracker );
tor->tracker = NULL;
while( tor->peerCount > 0 )
{
@ -422,8 +423,8 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
s->rateDownload = 0.0;
s->rateUpload = tr_rcRate( tor->upload );
s->seeders = tr_trackerSeeders(tor);
s->leechers = tr_trackerLeechers(tor);
s->seeders = tr_trackerSeeders(tor->tracker);
s->leechers = tr_trackerLeechers(tor->tracker);
if( s->rateDownload < 0.1 )
{