Changeset 10346


Ignore:
Timestamp:
Mar 10, 2010, 3:34:27 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2993 "'Downloaded' much greater than 'Have' or 'Verified'" -- tweak the new throttle code based on slow download feedback from gn0s1s in irc, from Rascal @ http://trac.transmissionbt.com/ticket/2993#comment:29, and from AGSystem @ http://forum.transmissionbt.com/viewtopic.php?p=45631&f=1#p45631

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r10332 r10346  
    23502350    /* decide how many peers to be interested in */
    23512351    {
    2352         const int blocks = tr_historyGet( t->tor->blocksSentToClient, now, msec );
    2353         const int cancels = tr_historyGet( t->tor->cancelsSentToPeer, now, msec );
    2354 
    2355         if( !cancels && !t->interestedCount )
     2352        int blocks = 0;
     2353        int cancels = 0;
     2354
     2355        /* Count up how many blocks & cancels each peer has.
     2356         *
     2357         * There are two situations where we send out cancels --
     2358         *
     2359         * 1. We've got unresponsive peers, which is handled by deciding
     2360         *    -which- peers to be interested in.
     2361         *
     2362         * 2. We've hit our bandwidth cap, which is handled by deciding
     2363         *    -how many- peers to be interested in.
     2364         *
     2365         * We're working on 2. here, so we need to ignore unresponsive
     2366         * peers in our calculations lest they confuse Transmission into
     2367         * think it's hit its bandwidth cap.
     2368         */
     2369        for( i=0; i<peerCount; ++i )
     2370        {
     2371            const tr_peer * peer = tr_ptrArrayNth( &t->peers, i );
     2372            const int b = tr_historyGet( peer->blocksSentToClient, now, msec );
     2373            const int c = tr_historyGet( peer->cancelsSentToPeer, now, msec );
     2374
     2375            if( b == 0 ) /* ignore unresponsive peers, as described above */
     2376                continue;
     2377
     2378            blocks += b;
     2379            cancels += c;
     2380        }
     2381
     2382        if( !t->interestedCount )
    23562383        {
    23572384            /* this is the torrent's first time to call this function...
Note: See TracChangeset for help on using the changeset viewer.