feat(peers): allow updating connection timeout - #639
Conversation
Is there a non hypothetical use case? A real world problem that you have encountered that this PR helps solve |
|
I have been contributing to https://github.com/lostb1t/remux. It uses rqbit and I'm implementing automatic torrent selection in order to minimize startup time for playback. The change that I'm making is to make this timeout adaptive to balance minimizing startup latency and robustness in finding a good source. Remux currently uses a fixed 1.2s peer connection timeout. The change that I am making is implementing a 15s fast phase where we use the existing 1.2s timeout, but if after this fast phase, we fail to make a connection, we increase the timeout to 3s for future connection attempts and also broaden the search to more torrent sources. Without this setter, Remux must either use the slower timeout for every startup or remove and recreate the torrent, losing discovered peers, metadata, and downloaded pieces. |
Summary
Motivation
Callers may want a short connection timeout during latency-sensitive startup, then allow slower peers more time if the torrent has not found sufficient throughput. Recreating the managed torrent loses useful state and existing peer connections. A runtime setter permits that adaptive strategy while limiting the change to future connection attempts.
Testing