Loading crates/arti-client/src/client.rs +1 −1 Original line number Diff line number Diff line Loading @@ -1366,7 +1366,7 @@ impl<R: Runtime> TorClient<R> { self.statemgr.clone(), ) .map_err(ErrorDetail::LaunchOnionService)?; service.launch().map_err(ErrorDetail::LaunchOnionService)?; let _stream = service.launch().map_err(ErrorDetail::LaunchOnionService)?; // TODO HSS: Once OnionService::launch is non-async, make this function non-async. // TODO HSS: Once OnionService::launch returns a stream of something // reasonable, return that from here as well. Loading crates/tor-hsservice/src/svc.rs +22 −12 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use std::sync::{Arc, Mutex}; use futures::channel::mpsc; use futures::channel::oneshot; use futures::Stream; use tor_circmgr::hspool::HsCircPool; use tor_config::ReconfigureError; use tor_error::Bug; Loading @@ -18,6 +19,7 @@ use crate::ipt_set::IptsManagerView; use crate::svc::publish::Publisher; use crate::OnionServiceConfig; use crate::OnionServiceStatus; use crate::RendRequest; use crate::StartupError; pub(crate) mod ipt_establish; Loading Loading @@ -57,7 +59,10 @@ struct SvcInner { /// Handles that we'll take ownership of when launching the service. /// /// (TODO HSS: Having to consume this may indicate a design problem.) unlaunched: Option<Box<dyn Launchable + Send + Sync>>, unlaunched: Option<( mpsc::Receiver<RendRequest>, Box<dyn Launchable + Send + Sync>, )>, } /// Objects and handles needed to launch an onion service. Loading Loading @@ -164,11 +169,14 @@ impl OnionService { config_tx, shutdown_tx, keymgr, unlaunched: Some(Box::new(ForLaunch { unlaunched: Some(( rend_req_rx, Box::new(ForLaunch { publisher, ipt_mgr, ipt_mgr_view, })), }), )), }), })) } Loading @@ -195,11 +203,10 @@ impl OnionService { // TODO hss let's also have a function that gives you a stream of Status // changes? Or use a publish-based watcher? /// Tell this onion service to begin running. // // TODO HSS: Probably return an `impl Stream<RendRequest>`. pub fn launch(self: &Arc<Self>) -> Result<(), StartupError> { let launch = { /// Tell this onion service to begin running, and return a /// stream of rendezvous requests on the service. pub fn launch(self: &Arc<Self>) -> Result<impl Stream<Item = RendRequest>, StartupError> { let (rend_req_rx, launch) = { let mut inner = self.inner.lock().expect("poisoned lock"); inner .unlaunched Loading @@ -207,13 +214,16 @@ impl OnionService { .ok_or(StartupError::AlreadyLaunched)? }; launch.launch() launch.launch()?; // TODO HSS: This needs to launch at least the following tasks: // // - If we decide to use separate disk-based key provisioning, a task to // monitor our keys directory. // - If we own our identity key, a task to generate per-period sub-keys as // needed. Ok(rend_req_rx) } /// Tell this onion service to stop running. Loading Loading
crates/arti-client/src/client.rs +1 −1 Original line number Diff line number Diff line Loading @@ -1366,7 +1366,7 @@ impl<R: Runtime> TorClient<R> { self.statemgr.clone(), ) .map_err(ErrorDetail::LaunchOnionService)?; service.launch().map_err(ErrorDetail::LaunchOnionService)?; let _stream = service.launch().map_err(ErrorDetail::LaunchOnionService)?; // TODO HSS: Once OnionService::launch is non-async, make this function non-async. // TODO HSS: Once OnionService::launch returns a stream of something // reasonable, return that from here as well. Loading
crates/tor-hsservice/src/svc.rs +22 −12 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use std::sync::{Arc, Mutex}; use futures::channel::mpsc; use futures::channel::oneshot; use futures::Stream; use tor_circmgr::hspool::HsCircPool; use tor_config::ReconfigureError; use tor_error::Bug; Loading @@ -18,6 +19,7 @@ use crate::ipt_set::IptsManagerView; use crate::svc::publish::Publisher; use crate::OnionServiceConfig; use crate::OnionServiceStatus; use crate::RendRequest; use crate::StartupError; pub(crate) mod ipt_establish; Loading Loading @@ -57,7 +59,10 @@ struct SvcInner { /// Handles that we'll take ownership of when launching the service. /// /// (TODO HSS: Having to consume this may indicate a design problem.) unlaunched: Option<Box<dyn Launchable + Send + Sync>>, unlaunched: Option<( mpsc::Receiver<RendRequest>, Box<dyn Launchable + Send + Sync>, )>, } /// Objects and handles needed to launch an onion service. Loading Loading @@ -164,11 +169,14 @@ impl OnionService { config_tx, shutdown_tx, keymgr, unlaunched: Some(Box::new(ForLaunch { unlaunched: Some(( rend_req_rx, Box::new(ForLaunch { publisher, ipt_mgr, ipt_mgr_view, })), }), )), }), })) } Loading @@ -195,11 +203,10 @@ impl OnionService { // TODO hss let's also have a function that gives you a stream of Status // changes? Or use a publish-based watcher? /// Tell this onion service to begin running. // // TODO HSS: Probably return an `impl Stream<RendRequest>`. pub fn launch(self: &Arc<Self>) -> Result<(), StartupError> { let launch = { /// Tell this onion service to begin running, and return a /// stream of rendezvous requests on the service. pub fn launch(self: &Arc<Self>) -> Result<impl Stream<Item = RendRequest>, StartupError> { let (rend_req_rx, launch) = { let mut inner = self.inner.lock().expect("poisoned lock"); inner .unlaunched Loading @@ -207,13 +214,16 @@ impl OnionService { .ok_or(StartupError::AlreadyLaunched)? }; launch.launch() launch.launch()?; // TODO HSS: This needs to launch at least the following tasks: // // - If we decide to use separate disk-based key provisioning, a task to // monitor our keys directory. // - If we own our identity key, a task to generate per-period sub-keys as // needed. Ok(rend_req_rx) } /// Tell this onion service to stop running. Loading