Commit 972927d
feat: Add Downloader::with_pool_options() constructor (#213)
Adds a `Downloader::with_pool_options()` constructor that allows
configuring the internal `ConnectionPool` options.
Currently `Downloader::new()` hardcodes `Default::default()` for pool
options, which means the `idle_timeout` is always 5 seconds. The
`ConnectionPool` and `Options` types are already public, but there's no
way to pass them through to the `Downloader`.
We're from the
[Psyche/Nousnet](https://github.com/PsycheFoundation/nousnet) team
In our use case, peers exchange gradient via iroh-blobs. With the 5s
idle timeout, every connection gets dropped between transfers and a new
one is created for the next round.
On a devnet run with 6 peers, over 8 hours we see:
```
MaxPathIdReached warnings: 3,098
NAT traversal warnings: 3,344
Connection open/close cycles per hour: ~1,300
Handshake aborts: 31
```
```
2025-03-09T10:15:02 WARN iroh: MaxPathIdReached for connection ...
2025-03-09T10:15:02 WARN iroh: NAT traversal to ... via ... failed
2025-03-09T10:15:03 new connection to peer ...
2025-03-09T10:15:25 connection closed (idle timeout)
2025-03-09T10:15:25 new connection to peer ... <- same peer, 22s later
```
The `MaxPathIdReached` happens because QUIC path IDs are monotonically
increasing and never reused, constant connection churn burns through
them.
Being able to set a longer idle timeout (e.g. 60s) would let the pool
reuse connections across transfers, eliminating the churn entirely.
Here is how we plan to use it on NousNet
https://github.com/PsycheFoundation/nousnet/pull/600/changes
Feedback is really appreciated
---------
Signed-off-by: pefontana <fontana.pedro93@gmail.com>
Co-authored-by: pefontana <pedro@nous.com>1 parent 2088701 commit 972927d
1 file changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
341 | 345 | | |
342 | 346 | | |
343 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
344 | 356 | | |
345 | | - | |
| 357 | + | |
346 | 358 | | |
347 | 359 | | |
348 | 360 | | |
| |||
0 commit comments