mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
Fix: SignServer TCP ping for custom port (#2353)
This commit is contained in:
parent
da9f03fa47
commit
d85d697fc2
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/png"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@ -541,7 +542,18 @@ func signWaitServer() bool {
|
||||
log.Warnf("连接到签名服务器出现错误: %v", err)
|
||||
continue
|
||||
}
|
||||
r := utils.RunTCPPingLoop(u.Host, 4)
|
||||
host := u.Hostname()
|
||||
port := u.Port()
|
||||
if port == "" {
|
||||
switch u.Scheme {
|
||||
case "https":
|
||||
port = "443"
|
||||
case "http":
|
||||
port = "80"
|
||||
}
|
||||
}
|
||||
hostPort := net.JoinHostPort(host, port)
|
||||
r := utils.RunTCPPingLoop(hostPort, 4)
|
||||
if r.PacketsLoss > 0 {
|
||||
log.Warnf("连接到签名服务器出现错误: 丢包%d/%d 时延%dms", r.PacketsLoss, r.PacketsSent, r.AvgTimeMill)
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user