🧱 Chunk is a download manager for slow and unstable servers

The concurrency-per-server flag has no effect; the connection cap is fixed at 5 #4

Open cuducos.me
Open opened by cuducos.me

Problem

DefaultDownloader calls newClient(DefaultMaxRetries, DefaultTimeout) (downloader.go:445) — the wrong argument — so MaxConnsPerHost is set to 5 (DefaultMaxRetries), not DefaultConcurrencyPerServer (8). DownloadWithContext only rebuilds the client when it is nil (downloader.go:405-407), so setting ConcurrencyPerServer later — exactly what the CLI does (main.go:45) — changes nothing.

Impact

The -c/--concurrency-per-server flag is dead: the real connection cap is always 5 per server, regardless of the value requested.

Reproduction (verified)

  • Field set to 8 → transport cap is 5.
  • Field set to 42 → cap is still 5.

Suggested fix

Pass d.ConcurrencyPerServer to newClient, and rebuild the client when the concurrency/timeout configuration changes (or always when the fields are set).

Sign up or Sign in to add to the discussion.