lib/connections: Don't look at devices that are already optimally connected
Just an optimization. Required exposing the priority from the factory, so made that an interface with an extra method instead of just a func type. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3071
This commit is contained in:
committed by
Audrius Butkevicius
parent
31f64186ae
commit
d77d8ff803
@@ -21,7 +21,7 @@ import (
|
||||
const relayPriority = 200
|
||||
|
||||
func init() {
|
||||
dialers["relay"] = newRelayDialer
|
||||
dialers["relay"] = relayDialerFactory{}
|
||||
}
|
||||
|
||||
type relayDialer struct {
|
||||
@@ -74,9 +74,15 @@ func (d *relayDialer) String() string {
|
||||
return "Relay Dialer"
|
||||
}
|
||||
|
||||
func newRelayDialer(cfg *config.Wrapper, tlsCfg *tls.Config) genericDialer {
|
||||
type relayDialerFactory struct{}
|
||||
|
||||
func (relayDialerFactory) New(cfg *config.Wrapper, tlsCfg *tls.Config) genericDialer {
|
||||
return &relayDialer{
|
||||
cfg: cfg,
|
||||
tlsCfg: tlsCfg,
|
||||
}
|
||||
}
|
||||
|
||||
func (relayDialerFactory) Priority() int {
|
||||
return relayPriority
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user