Skip to content

Commit

Permalink
Driver: Fix crash on .leave() (#63)
Browse files Browse the repository at this point in the history
Leaving (rather than removing) a call would cause the driver to crash as it would try to use a non-existent connection immediately after it had been invalidated.

This has been tested using a modified `examples/serenity/voice_storage`, felyne, and via `cargo make ready`.
  • Loading branch information
FelixMcFelix authored Apr 10, 2021
1 parent 22214a0 commit 24d8da6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/driver/tasks/mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,14 @@ impl Mixer {
};
}

if let Err(e) = self.cycle().and_then(|_| self.audio_commands_events()) {
events_failure |= e.should_trigger_interconnect_rebuild();
conn_failure |= e.should_trigger_connect();
// The above action may have invalidated the connection; need to re-check!
if self.conn_active.is_some() {
if let Err(e) = self.cycle().and_then(|_| self.audio_commands_events()) {
events_failure |= e.should_trigger_interconnect_rebuild();
conn_failure |= e.should_trigger_connect();

debug!("Mixer thread cycle: {:?}", e);
debug!("Mixer thread cycle: {:?}", e);
}
}
} else {
match self.mix_rx.recv() {
Expand Down

0 comments on commit 24d8da6

Please sign in to comment.