Changeset 6910


Ignore:
Timestamp:
Oct 15, 2008, 5:53:42 PM (13 years ago)
Author:
charles
Message:

(libT) if a tracker announce succeeds and the tracker's response is a superset of a scrape response, then treat it as a successful announce AND scrape.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r6907 r6910  
    346346                   void *       torrent_hash )
    347347{
    348     int          retry;
    349     int          success = FALSE;
     348    int retry;
     349    int success = FALSE;
     350    int scrapeFields = 0;
    350351    tr_tracker * t;
    351352
     
    401402
    402403            if( ( tr_bencDictFindInt( &benc, "complete", &i ) ) )
     404            {
     405                ++scrapeFields;
    403406                t->seederCount = i;
     407            }
    404408
    405409            if( ( tr_bencDictFindInt( &benc, "incomplete", &i ) ) )
     410            {
     411                ++scrapeFields;
    406412                t->leecherCount = incomplete = i;
     413            }
    407414
    408415            if( ( tr_bencDictFindInt( &benc, "downloaded", &i ) ) )
     416            {
     417                ++scrapeFields;
    409418                t->timesDownloaded = i;
     419            }
    410420
    411421            if( ( tmp = tr_bencDictFind( &benc, "peers" ) ) )
     
    447457        dbgmsg( t->name, "request succeeded. reannouncing in %d seconds",
    448458                interval );
    449         if( t->scrapeAt <= now )
     459
     460        /* if the announce response was a superset of the scrape response,
     461           treat this as both a successful announce AND scrape. */
     462        if( scrapeFields >= 3 ) {
     463            t->lastScrapeResponse = responseCode;
     464            t->lastScrapeTime = now;
    450465            t->scrapeAt = now + t->scrapeIntervalSec + t->randOffset;
     466        }
     467
     468        /* most trackers don't provide all the scrape responses, but do
     469           provide most of them, so don't scrape too soon anyway */
     470        if( ( scrapeFields == 2 ) && ( t->scrapeAt <= ( now + 120 ) ) ) {
     471            t->scrapeAt = now + t->scrapeIntervalSec + t->randOffset;
     472        }
     473
    451474        t->reannounceAt = now + interval;
    452475        t->manualAnnounceAllowedAt = now + t->announceMinIntervalSec;
  • trunk/libtransmission/web.c

    r6909 r6910  
    231231
    232232    do {
    233         dbgmsg( stderr, "event_cb calling socket_action fd %d, mask %d", fd, mask );
     233        dbgmsg( "event_cb calling socket_action fd %d, mask %d", fd, mask );
    234234        rc = curl_multi_socket_action( g->multi, fd, mask, &g->still_running );
    235235    } while( rc == CURLM_CALL_MULTI_PERFORM );
Note: See TracChangeset for help on using the changeset viewer.