(trunk libT) modify announcer's scrape triggers as per discussion with Elbandi
This commit is contained in:
parent
0bffa36377
commit
60f9191fdc
|
@ -1072,6 +1072,7 @@ on_announce_done( const tr_announce_response * response,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char * str;
|
const char * str;
|
||||||
|
bool got_scrape_info = false;
|
||||||
const bool isStopped = event == TR_ANNOUNCE_EVENT_STOPPED;
|
const bool isStopped = event == TR_ANNOUNCE_EVENT_STOPPED;
|
||||||
|
|
||||||
publishErrorClear( tier );
|
publishErrorClear( tier );
|
||||||
|
@ -1079,9 +1080,20 @@ on_announce_done( const tr_announce_response * response,
|
||||||
if(( tracker = tier->currentTracker ))
|
if(( tracker = tier->currentTracker ))
|
||||||
{
|
{
|
||||||
tracker->consecutiveFailures = 0;
|
tracker->consecutiveFailures = 0;
|
||||||
tracker->seederCount = response->seeders;
|
|
||||||
tracker->leecherCount = response->leechers;
|
/* if the tracker included scrape fields in its announce response,
|
||||||
tracker->downloadCount = response->downloads;
|
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 ))
|
if(( str = response->tracker_id_str ))
|
||||||
{
|
{
|
||||||
|
@ -1117,9 +1129,18 @@ on_announce_done( const tr_announce_response * response,
|
||||||
sizeof( tier->lastAnnounceStr ) );
|
sizeof( tier->lastAnnounceStr ) );
|
||||||
|
|
||||||
tier->isRunning = data->isRunningOnSuccess;
|
tier->isRunning = data->isRunningOnSuccess;
|
||||||
tier->scrapeAt = get_next_scrape_time( announcer->session, tier, tier->scrapeIntervalSec );
|
|
||||||
tier->lastScrapeTime = now;
|
if( got_scrape_info )
|
||||||
tier->lastScrapeSucceeded = true;
|
{
|
||||||
|
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->lastAnnounceSucceeded = true;
|
||||||
tier->lastAnnouncePeerCount = response->pex_count
|
tier->lastAnnouncePeerCount = response->pex_count
|
||||||
+ response->pex6_count;
|
+ response->pex6_count;
|
||||||
|
|
Loading…
Reference in New Issue