Yes, I am the one responsible for this (broken) code, and I think that your assessment is correct, and that both the write handler and the configure() methods should be improved. Ideally we could add a testcase for it too... but it'll be ok without one.
If you could make a patch and/or submit a pull request, that would be awesome. Cliff On Mon, Jun 20, 2011 at 7:33 AM, Lars Bro <[email protected]> wrote: > The following is from the read handler in Rated Source. As far I read > this, a "token bucket" is now used, which > is an improved mechanism for managing packet flows. The token bucket > has both a rate and a capacity, both must not be 0. > > However, as CLICK_HZ is 1000 on my machine, the RatedSource will stop > working in the interval from 20 to 199 when > the rate is set by a write handler. > > I assume that the point is that the capacity is a constant(2) until > rate is so big that rate / another constant is greater. > Something like > > rate / 200 >= 2 : rate/200 ? 2 > > Is this correct? > > 189 case 1: { // rate > 190 unsigned rate; > 191 if (!IntArg().parse(s, rate)) > 192 return errh->error("syntax error"); > 193 rs->_tb.assign_adjust(rate, rate < CLICK_HZ / 50 ? 2 : rate / > 200); > 194 break; > 195 } > > > cat test.click > rs::RatedSource() | Print() -> Discard(); > > click -p 23232 test.click > > telnet 127.0.0.1 23232 > write rs.rate 19 > write rs.rate 20 > write rs.rate 199 > write rs.rate 200 > > 19 works, 20 thru 199 does not work, 200 works > > > yours, > Lars Bro > > _______________________________________________ > click mailing list > [email protected] > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > _______________________________________________ click mailing list [email protected] https://amsterdam.lcs.mit.edu/mailman/listinfo/click
