1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

(trunk libT) modify announcer's scrape triggers as per discussion with Elbandi

This commit is contained in:
Jordan Lee 2011-07-31 00:58:05 +00:00
parent 0bffa36377
commit 60f9191fdc

View file

@ -1072,6 +1072,7 @@ on_announce_done( const tr_announce_response * response,
{
int i;
const char * str;
bool got_scrape_info = false;
const bool isStopped = event == TR_ANNOUNCE_EVENT_STOPPED;
publishErrorClear( tier );
@ -1079,9 +1080,20 @@ on_announce_done( const tr_announce_response * response,
if(( tracker = tier->currentTracker ))
{
tracker->consecutiveFailures = 0;
tracker->seederCount = response->seeders;
tracker->leecherCount = response->leechers;
tracker->downloadCount = response->downloads;
/* if the tracker included scrape fields in its announce response,
then a separate scrape isn't needed */
got_scrape_info = response->seeders
|| response->leechers
|| response->downloads;
if( got_scrape_info )
{
tracker->seederCount = response->seeders;
tracker->leecherCount = response->leechers;
tracker->downloadCount = response->downloads;
}
if(( str = response->tracker_id_str ))
{
@ -1117,9 +1129,18 @@ on_announce_done( const tr_announce_response * response,
sizeof( tier->lastAnnounceStr ) );
tier->isRunning = data->isRunningOnSuccess;
tier->scrapeAt = get_next_scrape_time( announcer->session, tier, tier->scrapeIntervalSec );
tier->lastScrapeTime = now;
tier->lastScrapeSucceeded = true;
if( got_scrape_info )
{
tier->scrapeAt = get_next_scrape_time( announcer->session, tier, tier->scrapeIntervalSec );
tier->lastScrapeTime = now;
tier->lastScrapeSucceeded = true;
}
else if( tier->lastScrapeTime + tier->scrapeIntervalSec <= now )
{
tier->scrapeAt = get_next_scrape_time( announcer->session, tier, 0 );
}
tier->lastAnnounceSucceeded = true;
tier->lastAnnouncePeerCount = response->pex_count
+ response->pex6_count;