arp: increment lru when inserting a new entry

This commit is contained in:
Corentin Henry 2017-03-06 20:24:00 -08:00 committed by whitequark
parent 40d3a3ada8
commit 0f2b05ede7
1 changed files with 1 additions and 0 deletions

View File

@ -97,6 +97,7 @@ impl<'a> Cache for SliceCache<'a> {
fn fill(&mut self, protocol_addr: &IpAddress, hardware_addr: &EthernetAddress) {
if let None = self.find(protocol_addr) {
let lru_index = self.lru();
self.counter += 1;
self.storage[lru_index] =
(*protocol_addr, *hardware_addr, self.counter);
self.sort()