Changeset 12605


Ignore:
Timestamp:
Jul 31, 2011, 12:58:05 AM (10 years ago)
Author:
jordan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r12577 r12605  
    10731073            int i;
    10741074            const char * str;
     1075            bool got_scrape_info = false;
    10751076            const bool isStopped = event == TR_ANNOUNCE_EVENT_STOPPED;
    10761077
     
    10801081            {
    10811082                tracker->consecutiveFailures = 0;
    1082                 tracker->seederCount = response->seeders;
    1083                 tracker->leecherCount = response->leechers;
    1084                 tracker->downloadCount = response->downloads;
     1083
     1084                /* if the tracker included scrape fields in its announce response,
     1085                   then a separate scrape isn't needed */
     1086
     1087                got_scrape_info = response->seeders
     1088                               || response->leechers
     1089                               || response->downloads;
     1090
     1091                if( got_scrape_info )
     1092                {
     1093                    tracker->seederCount = response->seeders;
     1094                    tracker->leecherCount = response->leechers;
     1095                    tracker->downloadCount = response->downloads;
     1096                }
    10851097
    10861098                if(( str = response->tracker_id_str ))
     
    11181130
    11191131            tier->isRunning = data->isRunningOnSuccess;
    1120             tier->scrapeAt = get_next_scrape_time( announcer->session, tier, tier->scrapeIntervalSec );
    1121             tier->lastScrapeTime = now;
    1122             tier->lastScrapeSucceeded = true;
     1132
     1133            if( got_scrape_info )
     1134            {
     1135                tier->scrapeAt = get_next_scrape_time( announcer->session, tier, tier->scrapeIntervalSec );
     1136                tier->lastScrapeTime = now;
     1137                tier->lastScrapeSucceeded = true;
     1138            }
     1139            else if( tier->lastScrapeTime + tier->scrapeIntervalSec <= now )
     1140            {
     1141                tier->scrapeAt = get_next_scrape_time( announcer->session, tier, 0 );
     1142            }
     1143
    11231144            tier->lastAnnounceSucceeded = true;
    11241145            tier->lastAnnouncePeerCount = response->pex_count
Note: See TracChangeset for help on using the changeset viewer.