Changeset 2754


Ignore:
Timestamp:
Aug 14, 2007, 8:08:57 PM (15 years ago)
Author:
charles
Message:

(trunk) revert yesterday's tracker changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r2735 r2754  
    9292    int            randOffset;
    9393
     94    tr_flag_t      hasManyPeers;
    9495    tr_flag_t      completelyUnconnectable;
    9596    tr_flag_t      allUnreachIfError;
     
    210211static int shouldConnect( tr_tracker_t * tc )
    211212{
     213    tr_torrent_t * tor = tc->tor;
    212214    const uint64_t now = tr_date();
    213215
     
    265267    {
    266268        return 1;
     269    }
     270
     271    /* If there is quite a lot of people on this torrent, stress
     272       the tracker a bit until we get a decent number of peers */
     273    if( tc->hasManyPeers &&
     274        (tr_cpGetStatus ( tor->completion ) == TR_CP_INCOMPLETE ))
     275    {
     276        /* reannounce in 10 seconds if we have less than 5 peers */
     277        if( tor->peerCount < 5 )
     278        {
     279            if( now > tc->dateOk + 1000 * MAX( 10, tc->minInterval ) )
     280            {
     281                return 1;
     282            }
     283        }
     284        /* reannounce in 20 seconds if we have less than 10 peers */
     285        else if( tor->peerCount < 10 )
     286        {
     287            if( now > tc->dateOk + 1000 * MAX( 20, tc->minInterval ) )
     288            {
     289                return 1;
     290            }
     291        }
     292        /* reannounce in 30 seconds if we have less than 15 peers */
     293        else if( tor->peerCount < 15 )
     294        {
     295            if( now > tc->dateOk + 1000 * MAX( 30, tc->minInterval ) )
     296            {
     297                return 1;
     298            }
     299        }
    267300    }
    268301
     
    779812
    780813    tc->scrapeNeeded = scrapeNeeded;
     814    if( !scrapeNeeded )
     815    {
     816        tc->hasManyPeers = ( tc->seeders + tc->leechers >= 50 );
     817    }
    781818
    782819    beFoo = tr_bencDictFind( &beAll, "tracker id" );
     
    822859    {
    823860        tr_inf( "Tracker: got %d peers", peerCount );
     861        if( peerCount >= 50 )
     862        {
     863            tc->hasManyPeers = 1;
     864        }
    824865        *_peerCount = peerCount;
    825866        *_peerCompact = peerCompact;
     
    9651006    }
    9661007   
     1008    tc->hasManyPeers = ( tc->seeders + tc->leechers >= 50 );
     1009   
    9671010    tr_bencFree( &scrape );
    9681011}
Note: See TracChangeset for help on using the changeset viewer.