mirror of
https://github.com/daeuniverse/dae.git
synced 2025-08-04 09:09:58 +07:00
fix: calcMinLatency should skip no latency dialer
This commit is contained in:
@ -89,7 +89,7 @@ func resolveFile(u *url.URL, configDir string) (b []byte, err error) {
|
|||||||
return nil, fmt.Errorf("not support absolute path")
|
return nil, fmt.Errorf("not support absolute path")
|
||||||
}
|
}
|
||||||
/// Relative location.
|
/// Relative location.
|
||||||
// Make sure path safety.
|
// Make sure path is secure.
|
||||||
path := filepath.Join(configDir, u.Host, u.Path)
|
path := filepath.Join(configDir, u.Host, u.Path)
|
||||||
if err = common.IsFileInSubDir(path, configDir); err != nil {
|
if err = common.IsFileInSubDir(path, configDir); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -195,7 +195,10 @@ func (a *AliveDialerSet) NotifyLatencyChange(dialer *Dialer, alive bool) {
|
|||||||
|
|
||||||
func (a *AliveDialerSet) calcMinLatency() {
|
func (a *AliveDialerSet) calcMinLatency() {
|
||||||
for _, d := range a.inorderedAliveDialerSet {
|
for _, d := range a.inorderedAliveDialerSet {
|
||||||
latency := a.dialerToLatency[d]
|
latency, ok := a.dialerToLatency[d]
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if latency < a.minLatency.latency {
|
if latency < a.minLatency.latency {
|
||||||
a.minLatency.latency = latency
|
a.minLatency.latency = latency
|
||||||
a.minLatency.dialer = d
|
a.minLatency.dialer = d
|
||||||
|
Reference in New Issue
Block a user