|
@@ -41,8 +41,15 @@ var (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- errDisabled = errors.New("disabled by configuration")
|
|
|
- errDeprecated = errors.New("deprecated protocol")
|
|
|
+ // Dialers and listeners return errUnsupported (or a wrapped variant)
|
|
|
+ // when they are intentionally out of service due to configuration,
|
|
|
+ // build, etc. This is not logged loudly.
|
|
|
+ errUnsupported = errors.New("unsupported protocol")
|
|
|
+
|
|
|
+ // These are specific explanations for errUnsupported.
|
|
|
+ errDisabled = fmt.Errorf("%w: disabled by configuration", errUnsupported)
|
|
|
+ errDeprecated = fmt.Errorf("%w: deprecated", errUnsupported)
|
|
|
+ errNotInBuild = fmt.Errorf("%w: disabled at build time", errUnsupported)
|
|
|
)
|
|
|
|
|
|
const (
|
|
@@ -336,7 +343,6 @@ func (s *service) handle(ctx context.Context) error {
|
|
|
s.model.AddConnection(modelConn, hello)
|
|
|
continue
|
|
|
}
|
|
|
- return nil
|
|
|
}
|
|
|
|
|
|
func (s *service) connect(ctx context.Context) error {
|
|
@@ -441,16 +447,10 @@ func (s *service) connect(ctx context.Context) error {
|
|
|
if err != nil {
|
|
|
s.setConnectionStatus(addr, err)
|
|
|
}
|
|
|
- switch err {
|
|
|
- case nil:
|
|
|
- // all good
|
|
|
- case errDisabled:
|
|
|
- l.Debugln("Dialer for", uri, "is disabled")
|
|
|
- continue
|
|
|
- case errDeprecated:
|
|
|
- l.Debugln("Dialer for", uri, "is deprecated")
|
|
|
+ if errors.Is(err, errUnsupported) {
|
|
|
+ l.Debugf("Dialer for %v: %v", uri, err)
|
|
|
continue
|
|
|
- default:
|
|
|
+ } else if err != nil {
|
|
|
l.Infof("Dialer for %v: %v", uri, err)
|
|
|
continue
|
|
|
}
|
|
@@ -505,7 +505,6 @@ func (s *service) connect(ctx context.Context) error {
|
|
|
return ctx.Err()
|
|
|
}
|
|
|
}
|
|
|
- return nil
|
|
|
}
|
|
|
|
|
|
func (s *service) isLANHost(host string) bool {
|
|
@@ -634,16 +633,10 @@ func (s *service) CommitConfiguration(from, to config.Configuration) bool {
|
|
|
}
|
|
|
|
|
|
factory, err := getListenerFactory(to, uri)
|
|
|
- switch err {
|
|
|
- case nil:
|
|
|
- // all good
|
|
|
- case errDisabled:
|
|
|
- l.Debugln("Listener for", uri, "is disabled")
|
|
|
- continue
|
|
|
- case errDeprecated:
|
|
|
- l.Debugln("Listener for", uri, "is deprecated")
|
|
|
+ if errors.Is(err, errUnsupported) {
|
|
|
+ l.Debugf("Listener for %v: %v", uri, err)
|
|
|
continue
|
|
|
- default:
|
|
|
+ } else if err != nil {
|
|
|
l.Infof("Listener for %v: %v", uri, err)
|
|
|
continue
|
|
|
}
|