mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-09 06:18:31 -04:00
Send IP packet to WireGuard asynchronously
This commit is contained in:
parent
0bb6c27d86
commit
8243945970
1 changed files with 7 additions and 5 deletions
|
@ -77,12 +77,14 @@ impl smoltcp::phy::TxToken for TxToken {
|
||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
buffer.resize(len, 0);
|
buffer.resize(len, 0);
|
||||||
let result = f(&mut buffer);
|
let result = f(&mut buffer);
|
||||||
match futures::executor::block_on(self.wg.send_ip_packet(&buffer)) {
|
tokio::spawn(async move {
|
||||||
Ok(_) => {}
|
match self.wg.send_ip_packet(&buffer).await {
|
||||||
Err(e) => {
|
Ok(_) => {}
|
||||||
error!("Failed to send IP packet to WireGuard endpoint: {:?}", e);
|
Err(e) => {
|
||||||
|
error!("Failed to send IP packet to WireGuard endpoint: {:?}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue