[Click] Timers too fast
Bart Braem
bart.braem at ua.ac.be
Wed Oct 6 03:26:49 EDT 2004
Hi,
I'm trying to use timers to generate a constant flow of Hello messages from a
node. These Hello messages should be sent at a very limited rate (1 per
minute) so using RatedUnQueue is undesirable, right?
For the moment my code works but the rate is way to high, I get hundreds of
messages in 1 second instead of 1 every 10 seconds...
The code looks like this:
AODVHelloGenerator::AODVHelloGenerator():
Element(0,1),
timer(this)
{
// CONSTRUCTOR MUST MOD_INC_USE_COUNT
MOD_INC_USE_COUNT;
}
int AODVHelloGenerator::initialize(ErrorHandler *errh)
{
timer.initialize(this);
timer.schedule_now();
return 0;
}
void AODVHelloGenerator::run_timer(){
printf("packet sent\n");
fflush(stdout);
timer.reschedule_after_ms(10000);
}
Could someone explain me what I'm doing wrong here? Am I using timers the
wrong way?
Thanks
Bart
--
dwars, studentenblad van de UA
www.dwars.ua.ac.be
More information about the click
mailing list