Skip to content

Commit

Permalink
Exposing service to both IPv4 and IPv6, addressing remaining issues f…
Browse files Browse the repository at this point in the history
…rom # (#1366)

* create dual stack socket on non-windows systems only

---------

Co-authored-by: Anders Ballegaard <[email protected]>
  • Loading branch information
ernstkl and Anders Ballegaard authored Oct 6, 2024
1 parent 353c696 commit 0ddb3b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ https://github.com/librespot-org/librespot
- [core] `Credentials.username` is now an `Option` (breaking)
- [core] `Session::connect` tries multiple access points, retrying each one.
- [core] Each access point connection now timesout after 3 seconds.
- [core] Listen on both IPV4 and IPV6 on non-windows hosts
- [main] `autoplay {on|off}` now acts as an override. If unspecified, `librespot`
now follows the setting in the Connect client that controls it. (breaking)
- [metadata] Most metadata is now retrieved with the `spclient` (breaking)
Expand Down
9 changes: 7 additions & 2 deletions discovery/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{
borrow::Cow,
collections::BTreeMap,
convert::Infallible,
net::{Ipv4Addr, SocketAddr, TcpListener},
net::{Ipv4Addr, Ipv6Addr, SocketAddr, TcpListener},
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Poll},
Expand Down Expand Up @@ -266,7 +266,12 @@ pub struct DiscoveryServer {
impl DiscoveryServer {
pub fn new(config: Config, port: &mut u16) -> Result<Self, Error> {
let (discovery, cred_rx) = RequestHandler::new(config);
let address = SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), *port);
let address = if cfg!(windows) {
SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), *port)
} else {
// this creates a dual stack socket on non-windows systems
SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), *port)
};

let (close_tx, close_rx) = oneshot::channel();

Expand Down

0 comments on commit 0ddb3b4

Please sign in to comment.