@@ -73,6 +73,7 @@ struct SpircTask {
7373
7474 /// the state management object
7575 connect_state : ConnectState ,
76+ connect_established : bool ,
7677
7778 play_request_id : Option < u64 > ,
7879 play_status : SpircPlayStatus ,
@@ -226,6 +227,7 @@ impl Spirc {
226227 mixer,
227228
228229 connect_state,
230+ connect_established : false ,
229231
230232 play_request_id : None ,
231233 play_status : SpircPlayStatus :: Stopped ,
@@ -499,7 +501,7 @@ impl SpircTask {
499501 session_update,
500502 match |session_update| self . handle_session_update( session_update)
501503 } ,
502- cmd = async { commands?. recv( ) . await } , if commands. is_some( ) => if let Some ( cmd) = cmd {
504+ cmd = async { commands?. recv( ) . await } , if self . connect_established && commands. is_some( ) => if let Some ( cmd) = cmd {
503505 if let Err ( e) = self . handle_command( cmd) . await {
504506 debug!( "could not dispatch command: {}" , e) ;
505507 }
@@ -825,6 +827,8 @@ impl SpircTask {
825827 self . session. device_id( )
826828 ) ;
827829
830+ self . connect_established = true ;
831+
828832 let same_session = cluster. player_state . session_id == self . session . session_id ( )
829833 || cluster. player_state . session_id . is_empty ( ) ;
830834 if !cluster. active_device_id . is_empty ( ) || !same_session {
0 commit comments