qmdnsengine
qmdnsengine copied to clipboard
Fix handling multiple records with flush cache set
Currently, invalidation of superseded records is handled in Cache::addRecord()
as each record is added to the cache. However, this breaks when there are multiple records of the same type in a single message with 'flush cache' set. In that case, the records that were just added in the same message get immediately superseded and only the final record of that type persists in the cache.
To fix this, use 2 passes to update the cache when we receive a message. First, invalidate any records that will be superseded by those contained within the message, then add all records from the message to the cache.