Skip to content

Commit

Permalink
fix: dont ignore network write errors in tokio taks, log them instead
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian1409 authored and rw0x0 committed Dec 9, 2024
1 parent efb22cc commit 0823a5c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mpc-net/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ where
});
tokio::spawn(async move {
while let Some(write_job) = write_recv.recv().await {
let write_result = write.send(write_job.data).await;
// we don't really care if the receiver for a write job is gone, as this is a common case
// therefore we only emit a trace message
match write_job.ret.send(write_result) {
Ok(_) => {}
Err(_) => {
tracing::trace!("Debug: Write Job finished but receiver is gone!");
match write.send(write_job.data).await {
Ok(_) => {
// we don't really care if the receiver for a write job is gone, as this is a common case
// therefore we only emit a trace message
if write_job.ret.send(Ok(())).is_err() {
tracing::trace!("Debug: Write Job finished but receiver is gone!");
}
}
Err(err) => {
tracing::error!("Write job failed: {err}");
}
}
}
Expand Down

0 comments on commit 0823a5c

Please sign in to comment.