diff --git a/rpc/dial.go b/rpc/dial.go index 6e489507..8d96844e 100644 --- a/rpc/dial.go +++ b/rpc/dial.go @@ -322,6 +322,9 @@ func listMulticastInterfaces() []net.Interface { return interfaces } +// ErrMDNSQueryFailed is returned when a mDNS query fails to find a candidate. +var ErrMDNSQuery = errors.New("mDNS query failed to find a candidate") + func lookupMDNSCandidate(ctx context.Context, address string, logger utils.ZapCompatibleLogger) (*zeroconf.ServiceEntry, error) { candidates := []string{address, strings.ReplaceAll(address, ".", "-")} // RSDK-8205: logger.Desugar().Sugar() is necessary to massage a ZapCompatibleLogger into a @@ -356,7 +359,7 @@ func lookupMDNSCandidate(ctx context.Context, address string, logger utils.ZapCo if ctx.Err() != nil { return nil, ctx.Err() } - return nil, errors.New("mDNS query failed to find a candidate") + return nil, ErrMDNSQuery } func dialMulticastDNS( diff --git a/rpc/wrtc_call_queue_mongodb.go b/rpc/wrtc_call_queue_mongodb.go index b3ce8e55..205cb68b 100644 --- a/rpc/wrtc_call_queue_mongodb.go +++ b/rpc/wrtc_call_queue_mongodb.go @@ -1132,7 +1132,8 @@ func (queue *mongoDBWebRTCCallQueue) checkHostQueueSize(ctx context.Context, for return errTooManyConns } -var errOffline = status.Error(codes.Unavailable, "host appears to be offline; ensure machine is online and try again") +// ErrOffline is returned when a host appears to be offline. +var ErrOffline = errors.New("host appears to be offline; ensure machine is online and try again") // checkHostOnline will check if there is some operator for all the managed hosts that // claims to have an answerer online for that host. It does this by running an aggregation @@ -1167,7 +1168,7 @@ func (queue *mongoDBWebRTCCallQueue) checkHostOnline(ctx context.Context, hosts return err } if len(ret) == 0 { - return errOffline + return status.Error(codes.Unavailable, ErrOffline.Error()) } return nil } @@ -1188,7 +1189,7 @@ func (queue *mongoDBWebRTCCallQueue) incrementConnectionEstablishmentExpectedFai // error (internal error from MDB query, e.g.). We can tell from the passed in error. reason := "other" - if errors.Is(err, errOffline) { + if errors.Is(err, ErrOffline) { reason = "answerers_offline" } else if errors.Is(err, errTooManyConns) { reason = "too_many_callers" diff --git a/rpc/wrtc_client.go b/rpc/wrtc_client.go index 2397779a..74f8f8e6 100644 --- a/rpc/wrtc_client.go +++ b/rpc/wrtc_client.go @@ -389,7 +389,7 @@ func dialWebRTC( utils.PanicCapturingGo(func() { if err := exchangeCandidates(); err != nil { - logger.Warnw("Failed to exchange candidates", "err", err) + logger.Debugw("Failed to exchange candidates", "err", err) exchangeCancel(err) } }) @@ -412,7 +412,7 @@ func dialWebRTC( Error: ErrorToStatus(exchangeErr).Proto(), }, }); err != nil { - logger.Warnw("Problem sending error to signaling server", "err", err) + logger.Debugw("Problem sending error to signaling server", "err", err) } }) return nil, exchangeErr