tweaking the congestion handler a bit

This commit is contained in:
Ryan Tucker 2010-03-16 11:25:50 -04:00
parent a9262b201a
commit 7b14ba9488

View file

@ -120,8 +120,9 @@ class SlowFile:
else:
# we're late; something got slow.
lateness = starttime - self.lastblocktargettime
self.delayfactor += min(0.5, lateness)
logger.debug('%.2f seconds late (congestion?); setting delayfactor to %.2f' % (lateness, self.delayfactor))
if lateness > 0.2:
self.delayfactor += min(0.5, lateness)
logger.debug('%.2f seconds late (congestion?); setting delayfactor to %.2f' % (lateness, self.delayfactor))
targetspeed = self.speed/float(self.delayfactor)
self.lastblocktargettime = time.time() + len/float(targetspeed)
@ -129,7 +130,7 @@ class SlowFile:
if time.time() > self.lastdebug+60:
if self.delayfactor > 1:
# reduce the penalty a bit
self.delayfactor -= 0.1
self.delayfactor -= 0.2
targetspeed = self.speed/float(self.delayfactor)
self.lastblocktargettime = time.time() + len/float(targetspeed)