Changeset 7495


Ignore:
Timestamp:
Dec 24, 2008, 5:45:27 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #1627: OSX mutex lockup in 141 and up to 7490

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bandwidth.c

    r7493 r7495  
    88 * the Transmission project.
    99 *
    10  * $Id:$
     10 * $Id$
    1111 */
    1212
     
    297297    tr_ptrArray * tmp;
    298298    struct tr_peerIo ** peers;
     299    const uint64_t now = tr_date( );
     300    const uint64_t cutoff = now + 100; /* 1/10th of a second */
     301
    299302
    300303    /* allocateBandwidth() is a helper function with two purposes:
     
    312315    /* First phase of IO.  Tries to distribute bandwidth fairly to keep faster
    313316     * peers from starving the others.  Loop through the peers, giving each a
    314      * small chunk of bandwidth.  Keep looping until we run out of bandwidth
    315      * or pweers that can use it */
     317     * small chunk of bandwidth.  Keep looping until we reach the cutoff or
     318     * run out of bandwidth and/or peers that can use it */
    316319    n = peerCount;
    317320    i = n ? tr_cryptoWeakRandInt( n ) : 0; /* pick a random starting point */
    318     for( ; n>0; )
     321    for( ; n>0 && tr_date()<=cutoff; )
    319322    {
    320323        const int increment = n==1 ? 4096 : 1024;
Note: See TracChangeset for help on using the changeset viewer.