summaryrefslogtreecommitdiffstats
path: root/module/network/Bucket.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-12-20 20:18:11 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-12-20 20:18:11 +0100
commit9666001e570275fa08a5766639c437d40bbb0545 (patch)
tree174566817e3b11f09cbc5dbdb02dd72558e629fc /module/network/Bucket.py
parentbucket improvement (diff)
downloadpyload-9666001e570275fa08a5766639c437d40bbb0545.tar.xz
improved bucket
Diffstat (limited to 'module/network/Bucket.py')
-rw-r--r--module/network/Bucket.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/network/Bucket.py b/module/network/Bucket.py
index 04b706ff2..434cbe662 100644
--- a/module/network/Bucket.py
+++ b/module/network/Bucket.py
@@ -28,14 +28,16 @@ class Bucket:
self.lock = Lock()
def setRate(self, rate):
+ self.lock.acquire()
self.rate = rate
+ self.lock.release()
def add(self, amount):
self.lock.acquire()
self.drip()
allowable = min(amount, self.rate - self.content)
- if allowable < 3072:
- allowable = 0
+ if allowable > 0:
+ sleep(0.005)
self.content += allowable
self.lock.release()