1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 18:36:11 -05:00

Fix: keep probeInterval consistent for the same outbound (#1230)

This commit is contained in:
朱聖黎 (Zhu Sheng Li) 2021-08-25 20:16:10 +08:00 committed by GitHub
parent 4f9415d001
commit 67cd3ac40e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import (
"net"
"net/http"
"net/url"
"sort"
"sync"
"time"
@ -68,6 +69,7 @@ func (o *Observer) background() {
}
outbounds := hs.Select(o.config.SubjectSelector)
sort.Strings(outbounds)
o.updateStatus(outbounds)
@ -111,7 +113,7 @@ func (o *Observer) probe(outbound string) ProbeResult {
trackedCtx := session.TrackedConnectionError(o.ctx, errorCollectorForRequest)
conn, err := tagged.Dialer(trackedCtx, dest, outbound)
if err != nil {
return newError("cannot dial remote address", dest).Base(err)
return newError("cannot dial remote address ", dest).Base(err)
}
connection = conn
return nil
@ -158,7 +160,7 @@ func (o *Observer) probe(outbound string) ProbeResult {
fullerr.WriteToLog()
return ProbeResult{Alive: false, LastErrorReason: fullerr.Error()}
}
newError("the outbound ", outbound, "is alive:", GETTime.Seconds()).AtInfo().WriteToLog()
newError("the outbound ", outbound, " is alive:", GETTime.Seconds()).AtInfo().WriteToLog()
return ProbeResult{Alive: true, Delay: GETTime.Milliseconds()}
}