Skip to content

Commit

Permalink
修复 下载测速时间不准确、卡住的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
XIU2 committed Dec 24, 2020
1 parent dc68529 commit 638273b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ func main() {
var data_2 = make([]CloudflareIPData, 0)
downloadTestTime = time.Duration(downloadSecond) * time.Second

//println(downloadTestCount)
//println(downloadTestTime)
//println(downloadSecond)

fmt.Println("# XIU2/CloudflareSpeedTest " + version + "\n")
if ipv6Mode {
fmt.Println("开始延迟测速(模式:TCP IPv6,端口:" + strconv.Itoa(tcpPort) + "):")
Expand Down
3 changes: 1 addition & 2 deletions tcping.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func DownloadSpeedHandler(ip net.IPAddr) (bool, float32) {
Transport: nil,
CheckRedirect: nil,
Jar: nil,
Timeout: 0,
Timeout: downloadTestTime,
}
var fullAddress string
if ipv6Mode { // IPv6 需要加上 []
Expand All @@ -124,7 +124,6 @@ func DownloadSpeedHandler(ip net.IPAddr) (bool, float32) {
DialContext: GetDialContextByAddr(fullAddress),
}
response, err := client.Get(url)

if err != nil {
return false, 0
} else {
Expand Down

0 comments on commit 638273b

Please sign in to comment.