Skip to content

Commit

Permalink
Merge pull request #593 from freaksdotcom/readall
Browse files Browse the repository at this point in the history
Call ReadAll() on the body io.ReadCloser to allow the http keepalive connection to be reused.
  • Loading branch information
gilbertchen authored Apr 10, 2020
2 parents bcb8892 + 6bf0d22 commit 8c80470
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/duplicacy_dropboxstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package duplicacy

import (
"fmt"
"io/ioutil"
"strings"

"github.com/gilbertchen/go-dropbox"
Expand Down Expand Up @@ -199,6 +200,7 @@ func (storage *DropboxStorage) DownloadFile(threadIndex int, filePath string, ch
}

defer output.Body.Close()
defer ioutil.ReadAll(output.Body)

_, err = RateLimitedCopy(chunk, output.Body, storage.DownloadRateLimit/len(storage.clients))
return err
Expand Down

0 comments on commit 8c80470

Please sign in to comment.