2010/7/22 Islam Hegazy <[email protected]>:
> Hi,
>
> For the resetInterval() in CtpRoutingEngineP.nc, I don't think it is doing
> its job when called from within BeaconTimer.fired(). Let me explain it by
> example:
>
> Suppose that tHasPassed = false, thus BeaconTimer.fired() will call in
> order:
> 1 - updateRouteTask()
>
> 2 - sendBeaconTask()
>
> 3 - remainingInterval()
>
> Suppose that updateRouteTask() has this condition satisfied:
>
>         if (currentEtx - minEtx > 20)
>
>             call CtpInfo.triggerRouteUpdate();
>
> which finally calls resetInterval():
>
>         currentInterval = 128        //minInterval value in CTP
>
>         t = 64
>
>         t = 78        //assume that Rand() % t  returned 14
>
>         tHasPassed = FALSE;
>
>        call BeaconTimer.startOneShot(78);
>
> This means that after 78 time units fire the BeaconTimer to call
> updateRotueTask(), sendBeaconTask(), and remainingInterval() (remember
> tHasPassed = false)
>
> However, after updateRotueTask() (step 1 above) returns, sendBeaconTask and
> remainingInterval (step 2 & 3) are called.
>
> remainingInterval() basically will cancel the timer set in resetInterval():
>
>         uint32_t remaining = 128;
>
>         remaining = 128 - 78 = 50;
>
>         tHasPassed = TRUE;
>
>         call BeaconTimer.startOneShot(50);
>
> So, firing timer at 78 is cancelled and reset 50 but to call decayInterval()
> instead

I agree with the weirdness going on there. resetInterval() (called
from a task) happens after remainingInterval() is executed?



> Accordingly, resetInterval() should set currentInterval = minInterval only
> without setting the beacon timer because it will be reset later. However
> this may conflict with other parts of the code which I didn't trace.

If you do this, it could take a long time to get your first beacon
after the reset. For example, the timer might be set to fire (to send
beacons) 5 minutes from now and you will have to wait that long if you
don't set the beacon timer to fire early.

- om_p

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to