mirror of https://github.com/perkeep/perkeep.git
client: close HTTP responses when done.
camput was failing for large amounts of files because there were too many open connections. Change-Id: I5a8b93070f14601ec0f4102634ed62fd83a021d8
This commit is contained in:
parent
85d2472b34
commit
999098b187
|
@ -200,6 +200,9 @@ func (c *Client) Stat(dest chan<- blobref.SizedBlobRef, blobs []*blobref.BlobRef
|
|||
if err != nil {
|
||||
return fmt.Errorf("stat HTTP error: %v", err)
|
||||
}
|
||||
if resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return fmt.Errorf("stat response had http status %d", resp.StatusCode)
|
||||
|
@ -246,6 +249,9 @@ func (c *Client) Upload(h *UploadHandle) (*PutResult, os.Error) {
|
|||
if err != nil {
|
||||
return errorf("stat http error: %v", err)
|
||||
}
|
||||
if resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return errorf("stat response had http status %d", resp.StatusCode)
|
||||
|
@ -313,6 +319,9 @@ func (c *Client) Upload(h *UploadHandle) (*PutResult, os.Error) {
|
|||
if err != nil {
|
||||
return errorf("upload http error: %v", err)
|
||||
}
|
||||
if resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
|
||||
// check error from earlier copy
|
||||
if err := <-copyResult; err != nil {
|
||||
|
|
Loading…
Reference in New Issue