From 09e9fd745ce1b58e2ede37e01f2f93c8e40772c2 Mon Sep 17 00:00:00 2001 From: Aditya Manthramurthy Date: Wed, 1 Mar 2017 22:48:55 +0530 Subject: [PATCH] Close client connection after checking for release update (#3820) --- cmd/update-main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/update-main.go b/cmd/update-main.go index e1348a3a8..21498679d 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -155,6 +155,10 @@ func downloadReleaseData(releaseChecksumURL string, timeout time.Duration) (data client := &http.Client{ Timeout: timeout, + Transport: &http.Transport{ + // need to close connection after usage. + DisableKeepAlives: true, + }, } resp, err := client.Do(req) @@ -164,6 +168,7 @@ func downloadReleaseData(releaseChecksumURL string, timeout time.Duration) (data if resp == nil { return data, fmt.Errorf("No response from server to download URL %s", releaseChecksumURL) } + defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return data, fmt.Errorf("Error downloading URL %s. Response: %v", releaseChecksumURL, resp.Status)