Limit keep alives for rate limited download test

This commit is contained in:
Matt Joiner 2021-08-18 14:49:13 +10:00
parent 588a7b6149
commit a3c2d76b4a
1 changed files with 9 additions and 2 deletions

View File

@ -250,6 +250,13 @@ func TestClientTransferRateLimitedUpload(t *testing.T) {
func TestClientTransferRateLimitedDownload(t *testing.T) {
testClientTransfer(t, testClientTransferParams{
LeecherDownloadRateLimiter: rate.NewLimiter(512, 512),
ConfigureSeeder: ConfigureClient{
Config: func(cfg *torrent.ClientConfig) {
// If we send too many keep alives, we consume all the leechers available download
// rate. The default isn't exposed, but a minute is pretty reasonable.
cfg.KeepAliveTimeout = time.Minute
},
},
})
}
@ -427,6 +434,6 @@ func TestSeedAfterDownloading(t *testing.T) {
}
type ConfigureClient struct {
Config func(*torrent.ClientConfig)
Client func(*torrent.Client)
Config func(cfg *torrent.ClientConfig)
Client func(cl *torrent.Client)
}