Skip to content

Commit

Permalink
Let the WebSocket server serve its data even without the web-viewer f…
Browse files Browse the repository at this point in the history
…eature (#8145)

* Fixes #8140

* [x] 🚢
  • Loading branch information
teh-cmc authored Nov 14, 2024
1 parent eee805e commit 1a30934
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/store/re_ws_comms/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ impl RerunServer {
self.num_accepted_clients.load(Ordering::Relaxed)
}

/// Blocks execution as long as the server is running.
///
/// There's no way of shutting the server down from the outside right now.
pub fn block(mut self) {
if let Some(listener_join_handle) = self.listener_join_handle.take() {
listener_join_handle.join().ok();
}
}

fn listen_thread_func(
poller: &Poller,
listener_socket: &TcpListener,
Expand Down
6 changes: 6 additions & 0 deletions crates/top/rerun/src/commands/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,12 @@ fn run_impl(
.block(); // dropping should stop the server
}

#[cfg(not(feature = "web_viewer"))]
{
// Returning from this function so soon would drop and therefore stop the server.
_ws_server.block();
}

return Ok(());
}
} else if is_another_viewer_running {
Expand Down

0 comments on commit 1a30934

Please sign in to comment.