Spotifyd / spotifyd

A spotify daemon
https://spotifyd.rs
GNU General Public License v3.0
9.68k stars 444 forks source link

Cannot run spotifyd with multiple IPs on the same interface #1285

Open nalves599 opened 1 month ago

nalves599 commented 1 month ago

Description Cannot launch spotifyd with discovery when there are 2 IPs (i.e. 2 IPv4 ) on the same interface. It gives the following error:

Message:  called `Result::unwrap()` on an `Err` value: DnsSdError(Os { code: 98, kind: AddrInUse, message: "Address already in use" })

To Reproduce

  1. Run spotifyd --no-daemon and ensure it works. Close the program.
  2. Add an IPv4 to your network interface (e.g. sudo ip add 192.168.1.123/24 dev enp1s0)
  3. Run spotifyd --no-daemon again and it will get the error above.

Expected behavior If the Zeroconf server is already listening on all interfaces with 0.0.0.0 it should not try to bind to the other IP.

Logs

Click to show logs ``` spotifyd --no-daemon --verbose No config file specified. Running with default values CliConfig { config_path: None, no_daemon: true, verbose: true, pid: None, shared_config: SharedConfigValues { username: None, username_cmd: None, password: None, password_cmd: None, use_keyring: false, use_mpris: None, dbus_type: None, on_song_change_hook: None, cache_path: None, no-audio-cache: false, backend: None, volume_controller: None, device: None, control: None, mixer: None, device_name: None, bitrate: None, audio_format: None, initial_volume: None, volume_normalisation: false, normalisation_pregain: None, zeroconf_port: None, proxy: None, device_type: None, autoplay: false, max_cache_size: None } } Found user shell: Some("/run/current-system/sw/bin/bash") No username specified. Checking username_cmd No username_cmd specified No password specified. Checking password_cmd No password_cmd specified No proxy specified registering event source with poller: token=Token(2147483649), interests=READABLE Using software volume controller. no usable credentials found, enabling discovery Using device id '3ad21dfd52db1f2f20d8a9815c37bc58c8d0b643' registering event source with poller: token=Token(0), interests=READABLE | WRITABLE Zeroconf server listening on 0.0.0.0:35523 registering event source with poller: token=Token(1), interests=READABLE | WRITABLE deregistering event source from poller The application panicked (crashed). Message: called `Result::unwrap()` on an `Err` value: DnsSdError(Os { code: 98, kind: AddrInUse, message: "Address already in use" }) Location: src/setup.rs:105 Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. Run with RUST_BACKTRACE=full to include source snippets. Shutting down discovery server deregistering event source from poller ```

Compilation flags

Versions (please complete the following information):