Merge pull request #645 from WankkoRee/pr-close-http-conn

fix: close http connections when each ip test ended
This commit is contained in:
XIU2
2026-04-29 19:07:38 +08:00
committed by GitHub
2 changed files with 2 additions and 0 deletions

View File

@@ -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 { // 调试模式下,输出更多信息

View File

@@ -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