Skip to content

Commit

Permalink
improve ServeGuard a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Apr 22, 2024
1 parent b469b5b commit 1672a7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
9 changes: 0 additions & 9 deletions crates/re_web_viewer_server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ use std::{
sync::{atomic::AtomicBool, Arc},
};

#[cfg(feature = "sync")]
mod sync;
#[cfg(feature = "sync")]
pub use sync::WebViewerServerHandle;

pub const DEFAULT_WEB_VIEWER_SERVER_PORT: u16 = 9090;

// See `Cargo.toml` docs for the `__ci` feature for more information about the `disable_web_viewer_server` cfg:
Expand All @@ -42,10 +37,6 @@ pub enum WebViewerServerError {

#[error("Failed to create server at address {0}: {1}")]
CreateServerFailed(String, Box<dyn std::error::Error + Send + Sync + 'static>),

#[cfg(feature = "sync")]
#[error("Failed to spawn web viewer thread: {0}")]
ThreadSpawnFailed(#[from] std::io::Error),
}

// ----------------------------------------------------------------------------
Expand Down
11 changes: 2 additions & 9 deletions crates/rerun/src/clap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,16 @@ pub struct RerunArgs {
/// were passed in.
/// This object makes sure they live long enough and get polled as needed.
#[doc(hidden)]
#[derive(Default)]
pub struct ServeGuard {
block_on_drop: bool,
}

// TODO:
impl Default for ServeGuard {
fn default() -> Self {
Self {
block_on_drop: false,
}
}
}

impl Drop for ServeGuard {
fn drop(&mut self) {
if self.block_on_drop {
eprintln!("Sleeping indefinitely while serving web viewer... Press ^C when done.");
// TODO(andreas): It would be a lot better if we had a handle to the web server and could call `block_until_shutdown` on it.
std::thread::sleep(std::time::Duration::from_secs(u64::MAX));
}
}
Expand Down

0 comments on commit 1672a7e

Please sign in to comment.