cache: handle stale list result

This commit is contained in:
Peter Cai 2021-04-06 11:16:12 +08:00
parent 74b117bc9f
commit a24088e17b

View file

@ -86,8 +86,16 @@ impl DnsCache {
)); ));
} }
if ret.len() == 0 {
// Sometimes the KV list operation may return stale keys that
// are no longer valid, resulting in we skipping over them in
// the main loop above. This could result in a non-empty
// keys array but an empty return value.
None
} else {
Some(ret) Some(ret)
} }
}
fn record_to_key(record: &Record<Dname<Vec<u8>>, OwnedRecordData>, buf: &[u8]) -> String { fn record_to_key(record: &Record<Dname<Vec<u8>>, OwnedRecordData>, buf: &[u8]) -> String {
format!( format!(