Skip to content

Commit

Permalink
Limit keep alives for rate limited download test
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Aug 19, 2021
1 parent 588a7b6 commit a3c2d76
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
})
}

Expand Down Expand Up @@ -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)
}

0 comments on commit a3c2d76

Please sign in to comment.