Opened 10 years ago

Closed 10 years ago

#5448 defect closed fixed (fixed)

twisted.protocols.htb.Bucket.drip() returns invalid results

Reported by: Greg Owned by: jesstess
Priority: normal Milestone:
Component: core Keywords:
Cc: jesstess, Thijs Triemstra, Greg Branch: branches/htb-drip-5448
branch-diff, diff-cov, branch-cov, buildbot
Author: gsk


From the api docs (

The method drip() of the Bucket class "Returns True if I am now empty."

The current drip() returns True only if the rate is zero (causing the bucket to drain instantaneously). This behavior does not take into account the possibility that a bucket will drain itself over time.

Attached is a patch containing a unit test for this issue and changes to the Bucket class that remedies this issue.

Attachments (1)

bucket.patch (1.8 KB) - added by Greg 10 years ago.
Unit test and patch to Bucket class

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by Greg

Attachment: bucket.patch added

Unit test and patch to Bucket class

comment:1 Changed 10 years ago by jesstess

Cc: jesstess Thijs Triemstra added
Owner: set to jesstess

comment:2 Changed 10 years ago by jesstess

Author: jesstess
Branch: branches/htb-drip-5448

(In [33448]) Branching to 'htb-drip-5448'

comment:3 Changed 10 years ago by jesstess

(In [33449]) Apply bucket.patch by gsk.

refs #5448

comment:4 Changed 10 years ago by jesstess

Author: jesstessgsk
Cc: Greg added
Keywords: review removed

Thanks for the bug report and patch, gsk! I've applied your patch with a couple of cosmetic changes so that it conforms to our coding standards. (The code surrounding your changes is quite old and doesn't set a good example :) ) You can see the changes in revision r33450, and read our coding standard here.

Buildbot results look good.

I'll go ahead and merge.

Thanks again for the patch!

comment:5 Changed 10 years ago by jesstess

Resolution: fixed
Status: newclosed

(In [33452]) Merge htb-drip-5448

Author: gsk Review: jesstess Fixes: #5448

Fix twisted.protocols.htb.Bucket.drip to drip and empty properly with a non-zero drip rate.

Note: See TracTickets for help on using tickets.