Revert "migration: go 1.21"

This reverts commit 33d41338ef.
This commit is contained in:
wwqgtxx
2023-09-21 08:25:26 +08:00
parent 0d7a57fa9d
commit 62266010ac
11 changed files with 63 additions and 20 deletions

View File

@ -136,21 +136,21 @@ func (p *Proxy) ExtraDelayHistory() map[string][]C.DelayHistory {
// LastDelay return last history record. if proxy is not alive, return the max value of uint16.
// implements C.Proxy
func (p *Proxy) LastDelay() (delay uint16) {
var maxDelay uint16 = 0xffff
var max uint16 = 0xffff
if !p.alive.Load() {
return maxDelay
return max
}
history := p.history.Last()
if history.Delay == 0 {
return maxDelay
return max
}
return history.Delay
}
// LastDelayForTestUrl implements C.Proxy
func (p *Proxy) LastDelayForTestUrl(url string) (delay uint16) {
var maxDelay uint16 = 0xffff
var max uint16 = 0xffff
alive := p.alive.Load()
history := p.history.Last()
@ -161,11 +161,11 @@ func (p *Proxy) LastDelayForTestUrl(url string) (delay uint16) {
}
if !alive {
return maxDelay
return max
}
if history.Delay == 0 {
return maxDelay
return max
}
return history.Delay
}