mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-06 08:02:36 +00:00
nat: waiting for available capacity instead of dropping downlink packets
This commit is contained in:
1 parent
8154f5c2e1
commit
cff7a9b47e
2 files changed
+5
-2
No files matched your search
@@ -166,11 +166,13 @@ impl NatManager {
|
||||
src_addr: Some(addr.clone()),
|
||||
dst_addr: Some(SocksAddr::from(raddr)),
|
||||
};
|
||||
if let Err(err) = client_ch_tx.try_send(pkt) {
|
||||
if let Err(err) = client_ch_tx.send(pkt).await {
|
||||
debug!(
|
||||
"send downlink packet failed {} -> {}: {}",
|
||||
&addr, &raddr, err
|
||||
);
|
||||
sessions.lock().await.remove(&raddr);
|
||||
break;
|
||||
}
|
||||
|
||||
// activity update
|
||||
|
||||
@@ -141,10 +141,11 @@ impl NetStackImpl {
|
||||
let fakedns2 = fakedns.clone();
|
||||
let pcb = listener.pcb();
|
||||
|
||||
// Sending packets to TUN should be very fast.
|
||||
let (client_ch_tx, mut client_ch_rx): (
|
||||
TokioSender<UdpPacket>,
|
||||
TokioReceiver<UdpPacket>,
|
||||
) = tokio_channel(100);
|
||||
) = tokio_channel(32);
|
||||
|
||||
// downlink
|
||||
let lwip_lock2 = lwip_lock.clone();
|
||||
|
||||
Reference in new issue
Block a user