You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
Threepwood-7
committed
RUST-PAR-017: release reask leases by the TCP key, not the UDP endpoint
DL-11: ReaskEvent::SourceReleased carried the peer's UDP routing endpoint
(ip, udp_port), but the consumer release_direct_download_source_leases
(crates/emulebb-core/src/lib.rs) matches it against TCP-endpoint-keyed sets:
active_download_peer_endpoints and the download source registry leases are
keyed by source_endpoint_key = (ip, tcp_port), and the detach-exclusion path
retains the lease under that same TCP key. Since a peer's UDP port normally
differs from its TCP port (4672 vs 4662), every release raised on the reask
drop paths (FNF DropSource, low-rank re-engage, Remove command, RetryTcp
timeout) was a silent no-op: the lease leaked, acquire_* deferred the
endpoint forever, and the source could never be re-engaged until
disconnect_ed2k's full lease reset.
Fix: carry core's lease key through the detach registration and address all
release events by it.
- ReaskDetachArgs gains tcp_port (crates/emulebb-ed2k/src/ed2k_client_udp/
runtime.rs); both producers set it (the TCP session detach passes the
connected socket's remote port in ed2k_tcp/download/session/reask_detach.rs,
the Kad buddy path passes source.tcp_port in
crates/emulebb-core/src/ed2k_buddy_reask.rs).
- ReaskSource stores lease_endpoint = (ip, tcp_port) (ed2k_client_udp/
state.rs); ReaskService::remove_source returns it and RoutedReply carries
it (service.rs, source_set.rs), so every SourceReleased on the four drop
paths now addresses the lease core actually holds.
- SourceDead is unchanged: it keeps the UDP endpoint and core's (ip, file)
registry resolver, which keys on the IP only.
- NNP keying audited and left as is: registry NNP holds are (ip, tcp_port)
in the registry keyspace, and the MarkNoNeededParts loop command is
(ip, udp_port) in the loop keyspace - both consistent.
Tests pin the contract with distinct UDP/TCP ports on every path (runtime,
service, detach-args producers), plus a core test asserting a UDP endpoint
never matches the TCP-keyed lease sets while source_endpoint_key frees them.
Pure internal bookkeeping; no wire behavior changes.
0 commit comments