]> granicus.if.org Git - transmission/commitdiff
(trunk libT) minor revision to r12065: clamp the bandwidth before applying the ratio...
authorJordan Lee <jordan@transmissionbt.com>
Thu, 3 Mar 2011 07:20:18 +0000 (07:20 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Thu, 3 Mar 2011 07:20:18 +0000 (07:20 +0000)
libtransmission/bandwidth.c

index 97f921f16a6489f5ae6a5f66aac75bbd67a4a6fb..500d34bf60d1d83ad71828c353ae102aa9383096 100644 (file)
@@ -323,13 +323,14 @@ bandwidthClamp( const tr_bandwidth  * b,
             double desired = tr_bandwidthGetDesiredSpeed_Bps( b, TR_DOWN );
             double r = desired > 0.001 ? current / desired : 0;
             size_t i;
+
+            byteCount = MIN( byteCount, b->band[dir].bytesLeft );
+
                  if( r > 1.0 ) i = 0;
             else if( r > 0.9 ) i = byteCount * 0.9;
             else if( r > 0.8 ) i = byteCount * 0.8;
             else               i = byteCount;
 
-            byteCount = MIN( byteCount, b->band[dir].bytesLeft );
-
             //fprintf( stderr, "--> %.4f  (%f... %f) [%zu --> %zu]\n", r, current, desired, byteCount, i );
             byteCount = i;
         }