core: Add TrickleTimer::IsRunning and fix a typo

As suggested by @tommypec during the review of !2881, this adds TrickleTimer::IsRunning() and fixes the misspelled local variable timerExpitation (three occurrences) in trickle-timer.cc.

Why m_intervalExpiration and not m_timerExpiration: the in-interval transmit event is already spent once the transmit point of the current interval has passed, so checking it would report a running timer as stopped. m_intervalExpiration is scheduled by Enable() and Reset(), kept alive across interval rollovers, and cancelled only by Stop(), so it reflects the actual lifecycle.

A test case is added to the trickle-timer suite covering that lifecycle:

  • not running before Enable()
  • running after Enable() and after Reset()
  • still running after the in-interval transmit fires
  • not running after Stop()

The Trickle strategy in !2881 will switch its internal m_timerRunning flag to this method once this lands.

Edited by Usham Roy

Merge request reports

Loading
Loading