@@ -650,13 +650,17 @@ pub fn build_client(
650650 . connect_timeout ( Duration :: from_secs ( 15 ) )
651651 // No global timeout — downloads can be very long
652652 // Connection pool — keep enough idle connections to cover all
653- // segments of a typical multi-segment download. 16 matches
654- // MAX_SEGMENTS on a 4-core machine (cpu_cores * 4) and avoids
655- // expensive TCP+TLS re-handshakes when workers finish one segment
656- // and immediately start the next. 90 s idle timeout tolerates
657- // brief pauses / UI interaction without discarding warm connections.
653+ // segments of a multi-segment download so workers reuse warm
654+ // keep-alive connections instead of paying TCP+TLS re-handshake
655+ // costs when finishing one segment and starting the next.
656+ // 64 == MAX_SEGMENTS (segment_advisor caps io_cap at cpu_cores*4,
657+ // which reaches 64 on 16+ logical-core machines downloading large
658+ // files). The previous value of 16 (sized for a 4-core machine)
659+ // starved the idle pool on many-core hosts, forcing re-handshakes
660+ // for every segment beyond the 16th. 90 s idle timeout reclaims
661+ // the extra connections shortly after the download finishes.
658662 . pool_idle_timeout ( Duration :: from_secs ( 90 ) )
659- . pool_max_idle_per_host ( 16 )
663+ . pool_max_idle_per_host ( 64 )
660664 // Cookies — needed for session-based downloads (Google Drive, etc.).
661665 // reqwest follows RFC 6265: cookies are scoped to their domain.
662666 . cookie_store ( true )
0 commit comments