[fix] incorrect data save location for latency

This commit is contained in:
tommytag 2023-12-04 18:10:45 +08:00
parent aef87b29ba
commit 2d7538aca6
3 changed files with 9 additions and 0 deletions

View file

@ -48,6 +48,10 @@ func (p *Proxy) AliveForTestUrl(url string) bool {
return p.alive.Load()
}
func (p *Proxy) OriginalHealthCheckUrl(url string) {
p.url = url
}
// Dial implements C.Proxy
func (p *Proxy) Dial(metadata *C.Metadata) (C.Conn, error) {
ctx, cancel := context.WithTimeout(context.Background(), C.DefaultTCPTimeout)

View file

@ -114,6 +114,10 @@ func (pp *proxySetProvider) RegisterHealthCheckTask(url string, expectedStatus u
func (pp *proxySetProvider) setProxies(proxies []C.Proxy) {
pp.proxies = proxies
for _, proxy := range pp.proxies {
proxy.OriginalHealthCheckUrl(pp.healthCheck.url)
}
pp.healthCheck.setProxy(proxies)
if pp.healthCheck.auto() {
go pp.healthCheck.check()

View file

@ -155,6 +155,7 @@ type Proxy interface {
DelayHistory() []DelayHistory
ExtraDelayHistory() map[string][]DelayHistory
LastDelayForTestUrl(url string) uint16
OriginalHealthCheckUrl(url string)
URLTest(ctx context.Context, url string, expectedStatus utils.IntRanges[uint16]) (uint16, error)
// Deprecated: use DialContext instead.