Ticket #5448 defect closed fixed

Opened 2 years ago

Last modified 2 years ago

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

Reported by: gsk Owned by: jesstess
Priority: normal Milestone:
Component: core Keywords:
Cc: jesstess, thijs, gsk Branch: branches/htb-drip-5448
(diff, github, buildbot, log)
Author: gsk Launchpad Bug:


From the api docs ( http://twistedmatrix.com/documents/current/api/twisted.protocols.htb.Bucket.html)

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.


bucket.patch Download (1.8 KB) - added by gsk 2 years ago.
Unit test and patch to Bucket class

Change History

Changed 2 years ago by gsk

Unit test and patch to Bucket class


Changed 2 years ago by jesstess

  • cc jesstess, thijs added
  • owner set to jesstess


Changed 2 years ago by jesstess

  • branch set to branches/htb-drip-5448
  • branch_author set to jesstess

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


Changed 2 years ago by jesstess

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

refs #5448


Changed 2 years ago by jesstess

  • keywords review removed
  • cc gsk added
  • branch_author changed from jesstess to gsk

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!


Changed 2 years ago by jesstess

  • status changed from new to closed
  • resolution set to fixed

(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.