From 457c74d203aa52610c17327337bbe5068d7bdfc7 Mon Sep 17 00:00:00 2001 From: open-trade Date: Thu, 25 Mar 2021 18:46:52 +0800 Subject: [PATCH] refactor --- mod.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mod.rs b/mod.rs index 8e9e11a..87e9793 100644 --- a/mod.rs +++ b/mod.rs @@ -8,15 +8,7 @@ lazy_static::lazy_static! { static ref STOP: Arc> = Arc::new(Mutex::new(true)); } -fn is_running() -> bool { - !*STOP.lock().unwrap() -} - -pub fn start(license: &str, host: &str) { - if is_running() { - return; - } - *STOP.lock().unwrap() = false; +pub fn bootstrap(license: &str, host: &str) { let port = rendezvous_server::DEFAULT_PORT; let addr = format!("0.0.0.0:{}", port); let addr2 = format!("0.0.0.0:{}", port.parse::().unwrap_or(0) - 1); @@ -47,3 +39,7 @@ pub fn start(license: &str, host: &str) { pub fn stop() { *STOP.lock().unwrap() = true; } + +pub fn start() { + *STOP.lock().unwrap() = false; +}