init wait list

This commit is contained in:
asxalex 2024-10-26 09:48:16 +08:00
parent 07c6536d5a
commit e32c640466
2 changed files with 8 additions and 2 deletions

View File

@ -13,11 +13,12 @@ use tokio::sync::{
oneshot, oneshot,
}; };
use super::{get_edge, get_route_table, init_route}; use super::{get_edge, get_route_table, init_arp_wait_list, init_route};
static GLOBAL_ARP: OnceCell<ArpActor> = OnceCell::new(); static GLOBAL_ARP: OnceCell<ArpActor> = OnceCell::new();
pub fn init_arp() { pub fn init_arp() {
init_route(); init_route();
init_arp_wait_list();
let actor = ArpActor::new(); let actor = ArpActor::new();
GLOBAL_ARP.set(actor).unwrap(); GLOBAL_ARP.set(actor).unwrap();
} }

View File

@ -5,7 +5,7 @@ use etherparse::Ethernet2Header;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use sdlan_sn_rs::{ use sdlan_sn_rs::{
config::SDLAN_DEFAULT_TTL, config::SDLAN_DEFAULT_TTL,
utils::{aes_encrypt, get_current_timestamp, Mac}, utils::{aes_encrypt, get_current_timestamp, ip_to_string, mac_to_string, Mac},
}; };
use tracing::error; use tracing::error;
@ -58,6 +58,11 @@ impl ArpWaitList {
} }
async fn arp_arrived(&self, ip: u32, mac: Mac) { async fn arp_arrived(&self, ip: u32, mac: Mac) {
println!(
"arp for {} arrived: {}",
ip_to_string(&ip),
mac_to_string(&mac)
);
let Some(items) = self.content.remove(&ip) else { let Some(items) = self.content.remove(&ip) else {
return; return;
}; };