diff --git a/task/download.go b/task/download.go index a9c7cd8..9a4ba82 100644 --- a/task/download.go +++ b/task/download.go @@ -155,6 +155,7 @@ func downloadHandler(ip *net.IPAddr) (float64, string) { return nil }, } + defer client.CloseIdleConnections() req, err := http.NewRequest("GET", URL, nil) if err != nil { if utils.Debug { // 调试模式下,输出更多信息 diff --git a/task/httping.go b/task/httping.go index 485ec4a..2f36d69 100644 --- a/task/httping.go +++ b/task/httping.go @@ -37,6 +37,7 @@ func (p *Ping) httping(ip *net.IPAddr) (int, time.Duration, string) { return http.ErrUseLastResponse // 阻止重定向 }, } + defer hc.CloseIdleConnections() // 先访问一次获得 HTTP 状态码 及 地区码 var colo string