test: cover ratchet NSR expiry and add I2pDht::has_node
check / check (macos-latest) (push) Failing after 27s
check / check (ubuntu-latest) (push) Failing after 26s
check / check (windows-latest) (push) Failing after 28s

- Add Proposal 144 test for high-concurrency NSR survival, same-tag multi-NSR, and zombie ES expiry
- Add public I2pDht::has_node and assert node presence in the DHT round-trip test
- Reformat DHT announce cooldown call and query match arms in torrent_engine
This commit is contained in:
nandi committed 2026-11-28 19:48:22 -08:00
1 parent 5d97ad8b28
commit d95d4962f4
5 files changed
+202 -24

No files matched your search

+23 -24
View File
@@ -1150,13 +1150,7 @@ fn bt_dht_can_announce(
now_ms : UInt64,
cooldown_ms : UInt64,
) -> Bool {
bt_dht_cooldown_allow(
eng.dht_announce_cd,
node_hash,
ih,
now_ms,
cooldown_ms,
)
bt_dht_cooldown_allow(eng.dht_announce_cd, node_hash, ih, now_ms, cooldown_ms)
}
///|
@@ -1409,7 +1403,11 @@ fn Router::poll_dht_datagrams(
now_ms,
)
let query_cd_ms = if self.public_mode { 60000UL } else { 1500UL }
let announce_cd_ms = if self.public_mode { 300000UL } else { 5000UL }
let announce_cd_ms = if self.public_mode {
300000UL
} else {
5000UL
}
if nodes.length() > 0 {
let decoded_nodes = @bittorrent.decode_compact_nodes(
nodes,
@@ -1430,27 +1428,28 @@ fn Router::poll_dht_datagrams(
match tx.info_hash {
Some(ih) =>
match bt_find_torrent_by_ih(eng, ih) {
Some(t)
Some(t) =>
if !t.paused &&
t.known_peers.length() < 8 &&
eng.dht.pending_txs.length() < 24 &&
bt_dht_can_query(
eng,
dn.dest_hash,
ih,
now_ms,
query_cd_ms,
) =>
if self.send_dht_query(
t.known_peers.length() < 8 &&
eng.dht.pending_txs.length() < 24 &&
bt_dht_can_query(
eng,
sess,
dn.dest_hash,
dn.port,
GetPeers(info_hash=ih),
ih,
now_ms,
info_hash=Some(ih),
query_cd_ms,
) {
fanout_sent += 1
if self.send_dht_query(
eng,
sess,
dn.dest_hash,
dn.port,
GetPeers(info_hash=ih),
now_ms,
info_hash=Some(ih),
) {
fanout_sent += 1
}
}
_ => ()
}