cmd/torrent: Lower burst when there's a download rate limit

This commit is contained in:
Matt Joiner 2021-12-20 14:30:22 +11:00
parent cc0d223a65
commit 7772d50f74
1 changed files with 2 additions and 1 deletions

View File

@ -234,10 +234,11 @@ func downloadErr(flags downloadFlags) error {
clientConfig.SetListenAddr(flags.Addr)
}
if flags.UploadRate != nil {
// TODO: I think the upload rate limit could be much lower.
clientConfig.UploadRateLimiter = rate.NewLimiter(rate.Limit(*flags.UploadRate), 256<<10)
}
if flags.DownloadRate != nil {
clientConfig.DownloadRateLimiter = rate.NewLimiter(rate.Limit(*flags.DownloadRate), 1<<20)
clientConfig.DownloadRateLimiter = rate.NewLimiter(rate.Limit(*flags.DownloadRate), 1<<16)
}
if flags.Quiet {
clientConfig.Logger = log.Discard