Changeset 7491


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

(1.4x libT) possible fix for freeze bug reported by Spaham

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4x/libtransmission/bandwidth.c

    r7461 r7491  
    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:
     
    313316     * peers from starving the others.  Loop through the peers, giving each a
    314317     * small chunk of bandwidth.  Keep looping until we run out of bandwidth
    315      * or pweers that can use it */
     318     * 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.