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();
|
||||
buffer.resize(len, 0);
|
||||
let result = f(&mut buffer);
|
||||
match futures::executor::block_on(self.wg.send_ip_packet(&buffer)) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
error!("Failed to send IP packet to WireGuard endpoint: {:?}", e);
|
||||
tokio::spawn(async move {
|
||||
match self.wg.send_ip_packet(&buffer).await {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
error!("Failed to send IP packet to WireGuard endpoint: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
result
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue