Do not unwrap the oldest IP in QUIC connectiont table (#26272)

This commit is contained in:
Pankaj Garg 2022-06-27 17:17:08 -07:00 committed by GitHub
parent 9765034e04
commit 31d870fe1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -421,9 +421,15 @@ impl ConnectionTable {
}
}
}
if let Some(removed) = self.table.remove(&oldest_ip.unwrap()) {
self.total_size -= removed.len();
num_pruned += removed.len();
if let Some(oldest_ip) = oldest_ip {
if let Some(removed) = self.table.remove(&oldest_ip) {
self.total_size -= removed.len();
num_pruned += removed.len();
}
} else {
// No valid entries in the table with an IP address. Continuing the loop will cause
// infinite looping.
break;
}
}
num_pruned