Changeset 7495 for trunk/libtransmission/bandwidth.c
- Timestamp:
- Dec 24, 2008, 5:45:27 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bandwidth.c
r7493 r7495 8 8 * the Transmission project. 9 9 * 10 * $Id :$10 * $Id$ 11 11 */ 12 12 … … 297 297 tr_ptrArray * tmp; 298 298 struct tr_peerIo ** peers; 299 const uint64_t now = tr_date( ); 300 const uint64_t cutoff = now + 100; /* 1/10th of a second */ 301 299 302 300 303 /* allocateBandwidth() is a helper function with two purposes: … … 312 315 /* First phase of IO. Tries to distribute bandwidth fairly to keep faster 313 316 * peers from starving the others. Loop through the peers, giving each a 314 * small chunk of bandwidth. Keep looping until we r un out of bandwidth315 * 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 */ 316 319 n = peerCount; 317 320 i = n ? tr_cryptoWeakRandInt( n ) : 0; /* pick a random starting point */ 318 for( ; n>0 ; )321 for( ; n>0 && tr_date()<=cutoff; ) 319 322 { 320 323 const int increment = n==1 ? 4096 : 1024;
Note: See TracChangeset
for help on using the changeset viewer.