Skip to content

Commit

Permalink
Driver: Fix noisy errors, UDP message send failure spam.
Browse files Browse the repository at this point in the history
Closes #26.

This will also prevent a full reconnect failure from endlessly spamming attempts and error logs. I'll follow this up by looking into decent reconnection strategies, although sadly these won't be configurable until the next semver break due to an oversight on my part.
  • Loading branch information
FelixMcFelix committed Jan 17, 2021
1 parent 12776fc commit dcb6ad9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/driver/tasks/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ impl Interconnect {
}

pub fn poison_all(&self) {
self.poison();
let _ = self.mixer.send(MixerMessage::Poison);
self.poison();
}

pub fn restart_volatile_internals(&mut self) {
Expand Down
24 changes: 17 additions & 7 deletions src/driver/tasks/mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,31 @@ impl Mixer {
// event failure? rebuild interconnect.
// ws or udp failure? full connect
// (soft reconnect is covered by the ws task.)
//
// in both cases, send failure is fatal,
// but will only occur on disconnect.
// expecting this is fairly noisy, so exit silently.
if events_failure {
self.prevent_events = true;
self.interconnect
let sent = self
.interconnect
.core
.send(CoreMessage::RebuildInterconnect)
.expect("FATAL: No way to rebuild driver core from mixer.");
.send(CoreMessage::RebuildInterconnect);
events_failure = false;

if sent.is_err() {
break;
}
}

if conn_failure {
self.interconnect
.core
.send(CoreMessage::FullReconnect)
.expect("FATAL: No way to rebuild driver core from mixer.");
self.conn_active = None;
let sent = self.interconnect.core.send(CoreMessage::FullReconnect);
conn_failure = false;

if sent.is_err() {
break;
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/driver/tasks/udp_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ pub(crate) async fn runner(udp_msg_rx: Receiver<UdpTxMessage>, ssrc: u32, udp_tx
error!("Fatal UDP packet send error: {:?}.", e);
break;
},
Ok(Err(_)) | Ok(Ok(Poison)) => {
Ok(Err(e)) => {
error!("Fatal UDP packet receive error: {:?}.", e);
break;
},
Ok(Ok(Poison)) => {
break;
},
}
Expand Down

0 comments on commit dcb6ad9

Please sign in to comment.