[Xorp-users] My new XorpTimer not working in PIM

swdickey at rockwellcollins.com swdickey at rockwellcollins.com
Thu Sep 1 16:38:10 PDT 2011


Good suggestion, doesn't seem to fix my problem though.  Actually, to 
debug this I went back to something even simpler which is giving me 
strange results.  I just copied the join_timer code:

join_timer() =
pim_node().eventloop().new_oneoff_after(
TimeVal(join_prune_period, 0);
callback(this, &PimMre::join_timer_timeout));

I added that code right before the 
pim_mre_join_prune::recompute_is_join_desired_**** methods call 
set_not_joined_state() and commented out all the join_timer().unschedule() 
calls.  [I know setting the join_timer in not_joined_state doesn't make 
sense for PIM but this is just to debug].  The join_timer won't fire when 
called during pruned state. This is the same code snippet which will 
successfully fire the join_timer() if we are in joined_state.

Is something stopping timers from firing when they are started in the 
not_joined / pruned state? 

S Dickey.





Ben Greear <greearb at candelatech.com> 
01/09/2011 04:35 PM

To
swdickey at rockwellcollins.com
cc
"xorp-users at xorp.org" <xorp-users at xorp.org>
Subject
Re: [Xorp-users] My new XorpTimer not working in PIM






On 09/01/2011 12:50 PM, swdickey at rockwellcollins.com wrote:
>
> Hi Hackers,
>
> I am trying out some code inside the 
pim_mre_join_prune::recompute_is_prune_desired_*** methods. After every 
set_pruned_state() call I want to set my new timer
> to fire every 30 seconds or so. This is the code I am using, its pretty 
much identical to the join_timer() which is why I'm confused that it 
doesn't work.
>
> Pim_Mre_Join_Prune::recompute_is_prune_desired_****
>
> TimeVal timeval = TimeVal(30,0);
>
> ...
>
> set_pruned_state();
>
> new_timer() =
> pim_node().eventloop().new_oneoff_after(
> timeval,
> callback(this, &PimMre::new_timer_timeout));
>
>
> //Later on...
> void
> PimMre::new_timer_timeout()
> {
> XLOG_TRACE(true, "New timer fired.");
> }
>
>
> PimMre.hh:
>
> XorpTimer& new_timer() { return(_new_timer); }
> constXorpTimer& const_new_timer() const{
> return(_new_timer);
> }
>
> XorpTimer _new_timer;
>
> //function to be called
> voidnew_timer_timeout();
>
>
>
> This code will run and will set the timer (new_timer().scheduled == 
true) but the timer will never fire! Interestingly, if I change the time 
to 5 milliseconds
> (TimeVal timeval = TimeVal(0,5);) then the new_timer will fire. I'm not 
sure if this is a timing issue or some memory is going out of scope and 
the 5 msec will
> fire the timer before the memory is overwritten.

Maybe the callback method needs to be a static method or plain
function instead of a class member?

Thanks,
Ben

>
> Any ideas? Thanks!
>
> S. Dickey
>
>
> _______________________________________________
> Xorp-users mailing list
> Xorp-users at xorp.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-users


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-users/attachments/20110901/cd417ebe/attachment.html 


More information about the Xorp-users mailing list