NordicPlayground / nRF51-ble-bcast-mesh

Other
323 stars 121 forks source link

handle_storage_next_timeout_get essential to proper function #177

Open dholth opened 7 years ago

dholth commented 7 years ago

I'm doing a little event queue simulation with trickle.c that was calling trickle_tx_timeout() at every step with t_now incrementing by 1 each step. If t_now starts at zero it transmits a modest number of packets, but if t_now starts at e.g. 4096, trickle_tx_timout() returns 'transmit now' very often.

The fix is to wait until min(trickle.t) before calling trickle_tx_timeout() as in order_next_transmission()

Should trickle_tx_timeout() work when called (many times) before trickle->t?

Thanks.

trond-snekvik commented 7 years ago

Hi, You're correct, the trickle_tx_timeout() function is meant to be called when the timeout occurs, as it doesn't check the time itself before making the decision.