Manager: improve error message when unable to create UPnP/SSDP server

Rather than just print the error message ("error creating UPnP/SSDP
server"), it now explains what the effect is of this error (workers
unable to automatically find this Manager) and how to solve it (pass
`-manager URL` to the Worker).
This commit is contained in:
Sybren A. Stüvel 2022-07-07 11:57:27 +02:00
parent 93a3436495
commit c87358b89b

View File

@ -445,7 +445,13 @@ func installSignalHandler(cancelFunc context.CancelFunc) {
func makeAutoDiscoverable(urls []url.URL) *upnp_ssdp.Server { func makeAutoDiscoverable(urls []url.URL) *upnp_ssdp.Server {
ssdp, err := upnp_ssdp.NewServer(log.Logger) ssdp, err := upnp_ssdp.NewServer(log.Logger)
if err != nil { if err != nil {
log.Error().Err(err).Msg("error creating UPnP/SSDP server") strUrls := make([]string, len(urls))
for idx := range urls {
strUrls[idx] = urls[idx].String()
}
log.Error().Strs("urls", strUrls).Msg("Unable to create UPnP/SSDP server. " +
"This means that Workers will not be able to automatically find this Manager. " +
"Run them with the `-manager URL` argument, picking a URL from this list.")
return nil return nil
} }