From a3c2d76b4afc15977b5b653a7b169bba0debdde5 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 18 Aug 2021 14:49:13 +1000 Subject: [PATCH] Limit keep alives for rate limited download test --- test/transfer_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/transfer_test.go b/test/transfer_test.go index c32dfa74..71de58b4 100644 --- a/test/transfer_test.go +++ b/test/transfer_test.go @@ -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) }