Track the initialized state of nstime_t on debug build.

Some nstime_t operations require and assume the input nstime is initialized
(e.g. nstime_update) -- uninitialized input may cause silent failures which is
difficult to reproduce / debug.  Add an explicit flag to track the state
(limited to debug build only).

Also fixed an use case in hpa (time of last_purge).
This commit is contained in:
Qi Wang 2021-11-16 14:51:07 -08:00 committed by Qi Wang
parent 400c59895a
commit cdabe908d0
3 changed files with 72 additions and 2 deletions

View file

@ -203,6 +203,7 @@ hpa_shard_init(hpa_shard_t *shard, hpa_central_t *central, emap_t *emap,
shard->opts = *opts;
shard->npending_purge = 0;
nstime_init_zero(&shard->last_purge);
shard->stats.npurge_passes = 0;
shard->stats.npurges = 0;