diff options
Diffstat (limited to 'src/router/router.rs')
| -rw-r--r-- | src/router/router.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/router/router.rs b/src/router/router.rs index 65de900..3f1e629 100644 --- a/src/router/router.rs +++ b/src/router/router.rs @@ -4,9 +4,15 @@ use emissary_util::reseeder::Reseeder; use emissary_util::runtime::tokio::Runtime as TokioRuntime; use emissary_util::storage::{Storage, StorageBundle}; use serde::{Deserialize, Serialize}; + use std::future::Future; use std::path::PathBuf; use std::sync::Arc; +use tokio::sync::Mutex; + +lazy_static::lazy_static! { + pub static ref ROUTER: Arc<Mutex<Option<Router<TokioRuntime>>>> = Arc::new(Mutex::new(None)); +} pub trait RouterUtils { fn config(&mut self) -> impl Future<Output = Result<(), Box<dyn std::error::Error>>> + Send; @@ -86,7 +92,7 @@ impl RouterUtils for Emissary { .store_router_info(info.name.to_string(), info.router_info.clone()) .await { - log::warn!("Failed to store reseeded router info: {}", e); + println!("Failed to store reseeded router info: {}", e); } bundle.routers.push(info.router_info); } @@ -96,7 +102,7 @@ impl RouterUtils for Emissary { self.storage_bundle = Some(bundle); return Err(format!("Reseed failed and no routers available: {}", e).into()); } else { - log::warn!("Reseed failed, but using existing routers: {}", e); + println!("Reseed failed, but using existing routers: {}", e); } } } @@ -142,7 +148,6 @@ impl RouterUtils for Emissary { .await .map_err(|e| format!("Router creation failed: {}", e))?; - // Сохраняем router_info, если он новый storage.store_local_router_info(router_info).await?; Ok(router) |
