Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when trying to listen on a taken TCP port #1650

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/re_sdk_comms/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::time::Instant;

use anyhow::Context as _;
use rand::{Rng as _, SeedableRng};

use re_log_types::{LogMsg, TimePoint, TimeType, TimelineName};
Expand Down Expand Up @@ -36,10 +35,12 @@ async fn listen_for_new_clients(
) {
let bind_addr = format!("0.0.0.0:{port}");

let listener = TcpListener::bind(&bind_addr)
.await
.with_context(|| format!("Failed to bind TCP address {bind_addr:?}"))
.unwrap();
let Ok(listener) = TcpListener::bind(&bind_addr).await else {
re_log::error!(
"Failed to bind TCP address {bind_addr:?}. Another Rerun instance is probably running."
);
return;
};

if options.quiet {
re_log::debug!(
Expand Down