Skip to content

Commit

Permalink
handle shutdown error upon restarting session (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
aome510 authored Oct 31, 2024
1 parent b45ad77 commit 1c3f09a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion spotify_player/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ impl Client {
let mut stream_conn = self.stream_conn.lock();
// shutdown old streaming connection and replace it with a new connection
if let Some(conn) = stream_conn.as_ref() {
conn.shutdown()?;
if let Err(err) = conn.shutdown() {
log::error!("Failed to shutdown old streaming connection: {err:#}");
}
}
*stream_conn = Some(new_conn);
Ok(())
Expand Down
4 changes: 3 additions & 1 deletion spotify_player/src/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub async fn new_connection(

let (spirc, spirc_task) = Spirc::new(connect_config, session, creds, player, mixer)
.await
.context("intialize spirc")?;
.context("initialize spirc")?;

tokio::task::spawn(async move {
tokio::select! {
Expand All @@ -236,5 +236,7 @@ pub async fn new_connection(
}
});

tracing::info!("New streaming connection has been established!");

Ok(spirc)
}

0 comments on commit 1c3f09a

Please sign in to comment.