Fix: ignore meanDelay error

This commit is contained in:
Dreamacro 2023-03-17 16:35:34 +08:00
parent 3b1d319820
commit 148ebccb60
1 changed files with 2 additions and 1 deletions

View File

@ -161,7 +161,8 @@ func (p *Proxy) URLTest(ctx context.Context, url string) (delay, meanDelay uint1
resp, err = client.Do(req) resp, err = client.Do(req)
if err != nil { if err != nil {
return // ignore error because some server will hijack the connection and close immediately
return delay, 0, nil
} }
resp.Body.Close() resp.Body.Close()
meanDelay = uint16(time.Since(start) / time.Millisecond / 2) meanDelay = uint16(time.Since(start) / time.Millisecond / 2)