mirror of https://github.com/ospab/ostp.git
start_udp_bypass_session (the TUN-mode path for UDP from apps/IPs the user has excluded from the tunnel) spawned a separate task to read from the physical-interface-bound socket, holding its own Arc<UdpSocket> clone. Nothing ever cancelled that task when the outer function returned (e.g. once session_rx closed) - it just kept running, and its socket clone kept the OS fd alive, for the lifetime of the process. Every distinct bypassed UDP flow (any excluded app's DNS query, game session, etc.) leaked one socket and one task permanently. The sibling function right below it, start_udp_session, already does this correctly: one tokio::select! loop combining both directions in a single task that exits (and drops the socket) as soon as either side closes. Rewrote start_udp_bypass_session to match that pattern instead of spawning a detached reader task. |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| test_udp.rs | ||