mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 12:42:27 +08:00
[Fixed] Positive health check multithreading is not safe
This commit is contained in:
parent
d35d6c9ac9
commit
75b5f633cd
@ -70,11 +70,10 @@ func (f *Fallback) onDialFailed() {
|
|||||||
f.failedTimes.Store(-1)
|
f.failedTimes.Store(-1)
|
||||||
f.failedTime.Store(-1)
|
f.failedTime.Store(-1)
|
||||||
} else {
|
} else {
|
||||||
f.failedTimes.Inc()
|
failedCount := f.failedTimes.Inc()
|
||||||
failedCount := f.failedTimes.Load()
|
|
||||||
log.Warnln("%s failed count: %d", f.Name(), failedCount)
|
log.Warnln("%s failed count: %d", f.Name(), failedCount)
|
||||||
if failedCount > 5 {
|
if failedCount > 5 {
|
||||||
log.Debugln("%s failed multiple times.", f.Name())
|
log.Warnln("because %s failed multiple times, active health check", f.Name())
|
||||||
for _, proxyProvider := range f.providers {
|
for _, proxyProvider := range f.providers {
|
||||||
go proxyProvider.HealthCheck()
|
go proxyProvider.HealthCheck()
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,10 @@ func (u *URLTest) onDialFailed() {
|
|||||||
u.failedTimes.Store(-1)
|
u.failedTimes.Store(-1)
|
||||||
u.failedTime.Store(-1)
|
u.failedTime.Store(-1)
|
||||||
} else {
|
} else {
|
||||||
u.failedTimes.Inc()
|
failedCount := u.failedTimes.Inc()
|
||||||
failedCount := u.failedTimes.Load()
|
|
||||||
log.Warnln("%s failed count: %d", u.Name(), failedCount)
|
log.Warnln("%s failed count: %d", u.Name(), failedCount)
|
||||||
if failedCount > 5 {
|
if failedCount > 5 {
|
||||||
log.Debugln("%s failed multiple times.", u.Name())
|
log.Warnln("because %s failed multiple times, active health check", u.Name())
|
||||||
for _, proxyProvider := range u.providers {
|
for _, proxyProvider := range u.providers {
|
||||||
go proxyProvider.HealthCheck()
|
go proxyProvider.HealthCheck()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user