arp: increment lru when inserting a new entry
This commit is contained in:
parent
40d3a3ada8
commit
0f2b05ede7
|
@ -97,6 +97,7 @@ impl<'a> Cache for SliceCache<'a> {
|
||||||
fn fill(&mut self, protocol_addr: &IpAddress, hardware_addr: &EthernetAddress) {
|
fn fill(&mut self, protocol_addr: &IpAddress, hardware_addr: &EthernetAddress) {
|
||||||
if let None = self.find(protocol_addr) {
|
if let None = self.find(protocol_addr) {
|
||||||
let lru_index = self.lru();
|
let lru_index = self.lru();
|
||||||
|
self.counter += 1;
|
||||||
self.storage[lru_index] =
|
self.storage[lru_index] =
|
||||||
(*protocol_addr, *hardware_addr, self.counter);
|
(*protocol_addr, *hardware_addr, self.counter);
|
||||||
self.sort()
|
self.sort()
|
||||||
|
|
Loading…
Reference in New Issue