in tun, should .await in eee.device.send

This commit is contained in:
alex 2026-07-04 15:20:10 +08:00
parent 0a40eac55e
commit 03151cc90e

View File

@ -443,14 +443,15 @@ impl TunTapPacketHandler for Iface {
arp.sipaddr = arp.sipaddr =
[((self_ip >> 16) & 0xffff) as u16, (self_ip & 0xffff) as u16]; [((self_ip >> 16) & 0xffff) as u16, (self_ip & 0xffff) as u16];
let mut data_buf = BytesMut::from(arp.marshal_to_bytes().as_slice()); let mut data_buf =
let encryptor = edge.encryptor.load(); BytesMut::from(arp.marshal_to_bytes().as_slice());
if let Err(e) = encryptor.encrypt(&mut data_buf) { let encryptor = edge.encryptor.load();
error!("failed to encrypt arp reply: {:?}", e); if let Err(e) = encryptor.encrypt(&mut data_buf) {
return Ok(()); error!("failed to encrypt arp reply: {:?}", e);
} return Ok(());
}
let data_bytes = data_buf.freeze(); let data_bytes = data_buf.freeze();
let data = SdlData { let data = SdlData {
is_p2p: true, is_p2p: true,
@ -523,7 +524,7 @@ impl TunTapPacketHandler for Iface {
// println!("got ip packet"); // println!("got ip packet");
// println!("got data: {:?}", rest); // println!("got data: {:?}", rest);
match edge.device.send(rest) { match edge.device.send(rest).await {
Ok(size) => { Ok(size) => {
debug!("send to tun {} bytes", size); debug!("send to tun {} bytes", size);
} }