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

Reply via email to