mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 10:00:27 +00:00
fix(http): keep Resolve response until Range takeover succeeds (#1465)
This commit is contained in:
3 files changed
+389
-67
No files matched your search
@@ -167,11 +167,13 @@ func newTestDownloadOptAt(path string) *base.Options {
|
||||
Path: path,
|
||||
Name: test.DownloadName,
|
||||
Extra: http.OptsExtra{
|
||||
Connections: 4,
|
||||
Connections: testDownloadConnections,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const testDownloadConnections = 4
|
||||
|
||||
func TestDownloader_Resolve(t *testing.T) {
|
||||
listener := test.StartTestFileServer()
|
||||
defer listener.Close()
|
||||
@@ -1479,7 +1481,11 @@ func TestDownloader_PauseAndContinue(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDownloader_PauseAllAndContinueAll(t *testing.T) {
|
||||
listener := test.StartTestSlowFileServer(time.Millisecond * 2000)
|
||||
const targetDownloadDuration = time.Second
|
||||
// Scale the per-byte delay with the configured connection count so a full
|
||||
// ranged transfer stays near one second and is still running at Pause.
|
||||
delayPerByte := targetDownloadDuration * testDownloadConnections / test.BuildSize
|
||||
listener := test.StartTestLowSpeedServer(delayPerByte)
|
||||
defer listener.Close()
|
||||
|
||||
downloader := NewDownloader(nil)
|
||||
|
||||
Reference in new issue
Block a user