[nat64-translator] ensure expired mappings are released in timer callback (#11139)

This commit fixes the release of expired mappings by ensuring that
`ReleaseExpiredMappings()` is always called from the timer callback
`HandleMappingExpirerTimer()`, regardless of the logging level.
Previously, `ReleaseExpiredMappings()` was called as an input to
`LogInfo()`, which could become an empty macro (ignoring its input)
if info-level logs were disabled.
This commit is contained in:
Abtin Keshavarzian
2025-01-08 21:00:09 -08:00
committed by GitHub
parent 5447ab8527
commit 5ddcb44a96
+6 -1
View File
@@ -552,8 +552,13 @@ exit:
void Translator::HandleMappingExpirerTimer(void)
{
LogInfo("Released %d expired mappings", ReleaseExpiredMappings());
uint16_t numReleased = ReleaseExpiredMappings();
LogInfo("Released %u expired mappings", numReleased);
mMappingExpirerTimer.Start(kAddressMappingIdleTimeoutMsec);
OT_UNUSED_VARIABLE(numReleased);
}
void Translator::InitAddressMappingIterator(AddressMappingIterator &aIterator)