webrtc: trim the comments to AGENTS.md length; drop is_direct_transport

386 added comment lines down to 287 across client, mediator, kcp_stream
and common. Same rule as hbb_common 3d64e43: out go past-bug narration,
rejected alternatives, measurements and restatements of the code; the
non-derivable why stays.

is_direct_transport goes with them. Judging the race by a transport
label was replaced by the resolved direct flag, leaving it used only by
its own test — and, having been inserted between the doc comment and
race_transports_prefer_webrtc, it had also taken that function's
contract with it. Removing it reattaches the doc where it belongs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExUfAkYbq8UC9pQCiLy8TQ
This commit is contained in:
rustdesk
2026-08-09 22:38:43 +08:00
parent bef87963e5
commit 6e78afe061
5 changed files with 55 additions and 171 deletions

View File

@@ -127,19 +127,10 @@ impl KcpStream {
let udp = udp_socket.clone();
tokio::spawn(async move {
let mut buf = vec![0; 1500];
// A connected UDP socket surfaces ICMP port-unreachable as an error on
// send/recv (WSAECONNRESET 10054 on Windows, ECONNREFUSED on Linux). For UDP
// these are advisory: a stray ICMP from a NAT rebind glitch or a momentary
// peer hiccup does not mean the path is dead, and KCP retransmits through it.
// Treat socket errors as packet loss instead of tearing the session down;
// a truly dead link is reaped by the KCP pong timeout / app-level timeouts.
// The short sleep prevents a persistently failing socket from busy-spinning.
//
// These repeat every 10ms while the socket stays broken, so throttle the line —
// debug output is written to the log file. One throttle per direction: an ICMP
// error on a connected socket is reported once and cleared, so the steady state is
// an alternation (send succeeds, the next recv reports the error), and a shared
// counter would be reset by the succeeding direction on every cycle.
// Socket errors are ICMP unreachable on a connected UDP socket — advisory, and
// routine while a hole forms — so treat them as loss and let KCP's pong timeout reap
// a link that is really dead. One throttle PER DIRECTION: the error is reported once
// and cleared, so send-ok/recv-err alternates and a shared counter never fires.
loop {
tokio::select! {
_ = &mut stop_receiver => {