Changeset 11307


Ignore:
Timestamp:
Oct 13, 2010, 3:56:25 AM (12 years ago)
Author:
charles
Message:

(trunk libT) #3596 "optimistic unchoke timer is too short" -- fixed.

File:
1 edited

Legend:

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

    r11301 r11307  
    4949    RECHOKE_PERIOD_MSEC = ( 10 * 1000 ),
    5050
     51    /* an optimistically unchoked peer is immune from rechoking
     52       for this many calls to rechokeUploads(). */
     53    OPTIMISTIC_UNCHOKE_MULTIPLIER = 4,
     54
    5155    /* how frequently to reallocate bandwidth */
    5256    BANDWIDTH_PERIOD_MSEC = 500,
     
    180184
    181185    tr_torrent               * tor;
     186    struct tr_peerMgr        * manager;
     187
    182188    tr_peer                  * optimistic; /* the optimistic peer, or NULL if none */
    183     struct tr_peerMgr        * manager;
     189    int                        optimisticUnchokeTimeScaler;
    184190
    185191    tr_bool                    isRunning;
     
    27102716    assert( torrentIsLocked( t ) );
    27112717
     2718    /* an optimistic unchoke peer's "optimistic"
     2719     * state lasts for N calls to rechokeUploads(). */
     2720    if( t->optimisticUnchokeTimeScaler > 0 )
     2721        t->optimisticUnchokeTimeScaler--;
     2722    else
     2723        t->optimistic = NULL;
     2724
    27122725    /* sort the peers by preference and rate */
    27132726    for( i = 0, size = 0; i < peerCount; ++i )
     
    27282741            tr_peerMsgsSetChoke( peer->msgs, TRUE );
    27292742        }
    2730         else
     2743        else if( peer != t->optimistic )
    27312744        {
    27322745            struct ChokeData * n = &choke[size++];
     
    27652778
    27662779    /* optimistic unchoke */
    2767     if( !isMaxedOut && (i<size) )
     2780    if( !t->optimistic && !isMaxedOut && (i<size) )
    27682781    {
    27692782        int n;
     
    27882801            c->isChoked = FALSE;
    27892802            t->optimistic = c->peer;
     2803            t->optimisticUnchokeTimeScaler = OPTIMISTIC_UNCHOKE_MULTIPLIER;
    27902804        }
    27912805
Note: See TracChangeset for help on using the changeset viewer.