core: AP connection attempts have 3 sec timeout. (#1350)
Some checks failed
test / cargo fmt (push) Failing after 21s
test / cargo +${{ matrix.toolchain }} clippy (${{ matrix.os }}) (ubuntu-latest, stable) (push) Has been skipped
test / cargo +${{ matrix.toolchain }} check (${{ matrix.os }}) (false, ubuntu-latest, 1.74) (push) Has been skipped
test / cargo +${{ matrix.toolchain }} check (${{ matrix.os }}) (false, ubuntu-latest, stable) (push) Has been skipped
test / cargo +${{ matrix.toolchain }} check (${{ matrix.os }}) (true, ubuntu-latest, beta) (push) Has been skipped
test / cargo +${{ matrix.toolchain }} check (${{ matrix.os }}) (windows-latest, 1.74) (push) Has been skipped
test / cargo +${{ matrix.toolchain }} check (${{ matrix.os }}) (windows-latest, stable) (push) Has been skipped
test / cross +${{ matrix.toolchain }} build ${{ matrix.target }} (ubuntu-latest, aarch64-unknown-linux-gnu, 1.74) (push) Has been skipped
test / cross +${{ matrix.toolchain }} build ${{ matrix.target }} (ubuntu-latest, aarch64-unknown-linux-gnu, stable) (push) Has been skipped
test / cross +${{ matrix.toolchain }} build ${{ matrix.target }} (ubuntu-latest, armv7-unknown-linux-gnueabihf, 1.74) (push) Has been skipped
test / cross +${{ matrix.toolchain }} build ${{ matrix.target }} (ubuntu-latest, armv7-unknown-linux-gnueabihf, stable) (push) Has been skipped
test / cross +${{ matrix.toolchain }} build ${{ matrix.target }} (ubuntu-latest, riscv64gc-unknown-linux-gnu, 1.74) (push) Has been skipped
test / cross +${{ matrix.toolchain }} build ${{ matrix.target }} (ubuntu-latest, riscv64gc-unknown-linux-gnu, stable) (push) Has been skipped

This commit is contained in:
Nick Steel 2024-09-25 20:34:59 +01:00 committed by GitHub
parent e02e4ae224
commit 118a9e1a51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -58,6 +58,7 @@ https://github.com/librespot-org/librespot
- [core] Support `Session` authentication with a Spotify access token
- [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.
- [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)

View file

@ -3,7 +3,7 @@ mod handshake;
pub use self::{codec::ApCodec, handshake::handshake};
use std::io;
use std::{io, time::Duration};
use futures_util::{SinkExt, StreamExt};
use num_traits::FromPrimitive;
@ -63,7 +63,8 @@ impl From<APLoginFailed> for AuthenticationError {
}
pub async fn connect(host: &str, port: u16, proxy: Option<&Url>) -> io::Result<Transport> {
let socket = crate::socket::connect(host, port, proxy).await?;
const TIMEOUT: Duration = Duration::from_secs(3);
let socket = tokio::time::timeout(TIMEOUT, crate::socket::connect(host, port, proxy)).await??;
handshake(socket).await
}