Skip to content

Commit

Permalink
pimd: fix missing the first round on wheel timer
Browse files Browse the repository at this point in the history
`wheel_add_timer` will not *update* currrent wheel timer's wake-up time.
It means next wake-up time is set before this insertion, and can't be changed.
So added timers in this round between `current slot` and `nexttime slot`
will unluckily miss the current round.

Clearly it will lead to this problem:
You expect to be woken up within 30s, you maybe be woken up within 60s.
Yes, it is bad luck to miss the first round, but won't miss any more
rounds.

Coincidentally, pimd has one of the most important judgement for this
time. If missed the first round, pimd will miss all the world.

This fix is small and convervative. Just doubles the desired time interval.
  • Loading branch information
anlancs committed Jan 30, 2022
1 parent 52ddb8d commit 4c71d8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pimd/pim_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,10 +2025,10 @@ static bool pim_upstream_sg_running_proc(struct pim_upstream *up)

// Have we seen packets?
if ((up->channel_oil->cc.oldpktcnt >= up->channel_oil->cc.pktcnt)
&& (up->channel_oil->cc.lastused / 100 > 30)) {
&& (up->channel_oil->cc.lastused / 100 > 60)) {
if (PIM_DEBUG_PIM_TRACE) {
zlog_debug(
"%s[%s]: %s old packet count is equal or lastused is greater than 30, (%ld,%ld,%lld)",
"%s[%s]: %s old packet count is equal or lastused is greater than 60, (%ld,%ld,%lld)",
__func__, up->sg_str, pim->vrf->name,
up->channel_oil->cc.oldpktcnt,
up->channel_oil->cc.pktcnt,
Expand Down

0 comments on commit 4c71d8b

Please sign in to comment.