Add a health check method to player

This commit is contained in:
Jarkko Lehtoranta 2023-06-13 17:38:41 +03:00
parent 46195f18d6
commit ddadcc9ea0
No known key found for this signature in database
GPG key ID: E539048C587D1F09

View file

@ -495,6 +495,13 @@ impl Player {
} }
} }
pub fn is_invalid(&self) -> bool {
if let Some(handle) = self.thread_handle.as_ref() {
return handle.is_finished();
}
true
}
fn command(&self, cmd: PlayerCommand) { fn command(&self, cmd: PlayerCommand) {
if let Some(commands) = self.commands.as_ref() { if let Some(commands) = self.commands.as_ref() {
if let Err(e) = commands.send(cmd) { if let Err(e) = commands.send(cmd) {