Skip to content

Commit

Permalink
Error instead of expect inside msg_encode. (#1857)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs authored Apr 14, 2023
1 parent b4190d8 commit 666c0c6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions crates/re_sdk_comms/src/buffered_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,23 @@ fn msg_encode(
MsgMsg::Flush => PacketMsg::Flush,
};

packet_tx
.send(packet_msg)
.expect("tcp_sender thread should live longer");
// TODO(jleibs): It's not clear why we're hitting this case, but an error here is still better than
// a panic. See: https://github.com/rerun-io/rerun/issues/1855
match packet_tx.send(packet_msg) {
Ok(_) => {},
Err(_) => {
re_log::error!("Failed to send message to tcp_sender thread. Likely a shutdown race-condition.");
},
};

msg_drop_tx.send(msg_msg).expect("Main thread should still be alive");
// TODO(jleibs): It's not clear why we're hitting this case, but an error here is still better than
// a panic. See: https://github.com/rerun-io/rerun/issues/1855
match msg_drop_tx.send(msg_msg) {
Ok(_) => {},
Err(_) => {
re_log::error!("Failed to send message to msg_dropp thread. Likely a shutdown race-condition");
},
};
} else {
return; // channel has closed
}
Expand Down

0 comments on commit 666c0c6

Please sign in to comment.