-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Describe the bug
When a prior invocation of netremote-server exited unexpectedly, the DNS-SD registration may not have been unregistered. In such cases, the next execution of netremote-server will complain that DNS-SD registration failed per below:
Netremote server starting (log level=info)
...
Netremote server started listening on 0.0.0.0:5047
Starting discovery service
Starting systemd-resolved DNS-SD service registration
Failed to register DNS-SD service with systemd-resolved: [org.freedesktop.resolve1.DnssdServiceExists] DNS-SD service 'netremote' exists already
Failed to register new DNS-SD service on dbusThe code ignores this assuming it is fine. In most cases it will be, however, if the new netremote-server execution was bound to a different IP address, then the DNS-SD registration would need to be replaced.
Steps To Reproduce
Steps to reproduce the behavior:
- Start
netremote-serverwith no arguments. - Forcibly kill the
netremote serverprocess (eg.kill -9 $(pidof netremote-server)). - Start
netremote-serverwith no arguments.
Expected behavior
Any old DNS-SD registration is removed, and replaced with an updated one. No error messages regarding DNS-SD are observed in the log.
Actual behavior
Error messages about failing to register DNS-SD appear, quoting existing registration. DNS-SD registration is not updated.
Proposed Fix
ResolvedDnssd::RegisterService should first check if any registration(s) for the supplied serviceName argument exist. If they do, they should be unregistered by calling the ResolvedDnssd::UnregisterService function with the object path of the existing DNS-SD registration.
