Pass HsCircPool to hsclient connect function, not CircMgr
We separated this out in the circmgr API. This is what the HS client needs. It doesn't want to participate in the general circuit pool.
This commit is contained in:
parent
00e522a91a
commit
9b6be7eaa7
|
@ -18,7 +18,10 @@ use tor_dirmgr::{DirMgrStore, Timeliness};
|
|||
use tor_error::{internal, Bug, ErrorReport};
|
||||
use tor_guardmgr::GuardMgr;
|
||||
#[cfg(feature = "onion-client")]
|
||||
use tor_hsclient::{HsClientConnector, HsClientSecretKeys};
|
||||
use {
|
||||
tor_circmgr::hspool::HsCircPool,
|
||||
tor_hsclient::{HsClientConnector, HsClientSecretKeys}
|
||||
};
|
||||
use tor_netdir::{params::NetParameters, NetDirProvider};
|
||||
use tor_persist::{FsStateMgr, StateMgr};
|
||||
use tor_proto::circuit::ClientCirc;
|
||||
|
@ -530,7 +533,7 @@ impl<R: Runtime> TorClient<R> {
|
|||
#[cfg(feature = "onion-client")]
|
||||
let hsclient = HsClientConnector::new(
|
||||
runtime.clone(),
|
||||
circmgr.clone(),
|
||||
HsCircPool::new(&circmgr),
|
||||
dirmgr.clone().upcast_arc(),
|
||||
)?;
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ use std::sync::{Arc, Mutex};
|
|||
|
||||
use educe::Educe;
|
||||
|
||||
use tor_circmgr::hspool::HsCircPool;
|
||||
use tor_circmgr::isolation::StreamIsolation;
|
||||
use tor_circmgr::CircMgr;
|
||||
use tor_hscrypto::pk::HsId;
|
||||
use tor_netdir::NetDirProvider;
|
||||
use tor_proto::circuit::ClientCirc;
|
||||
|
@ -79,7 +79,7 @@ pub struct HsClientConnector<R: Runtime, D: state::MockableConnectorData = conne
|
|||
runtime: R,
|
||||
/// A [`CircMgr`] that we use to build circuits to HsDirs, introduction
|
||||
/// points, and rendezvous points.
|
||||
circmgr: Arc<CircMgr<R>>,
|
||||
circpool: Arc<HsCircPool<R>>,
|
||||
/// A [`NetDirProvider`] that we use to pick rendezvous points.
|
||||
netdir_provider: Arc<dyn NetDirProvider>,
|
||||
/// Information we are remembering about different onion services.
|
||||
|
@ -92,14 +92,14 @@ impl<R: Runtime> HsClientConnector<R, connect::Data> {
|
|||
/// Create a new `HsClientConnector`
|
||||
pub fn new(
|
||||
runtime: R,
|
||||
circmgr: Arc<CircMgr<R>>,
|
||||
circpool: Arc<HsCircPool<R>>,
|
||||
netdir_provider: Arc<dyn NetDirProvider>,
|
||||
// TODO HS: there should be a config here, we will probably need it at some point
|
||||
// TODO HS: will needs a periodic task handle for us to expire old HS data/circuits
|
||||
) -> Result<Self, StartupError> {
|
||||
Ok(HsClientConnector {
|
||||
runtime,
|
||||
circmgr,
|
||||
circpool,
|
||||
netdir_provider,
|
||||
services: Arc::new(Mutex::new(Services::default())),
|
||||
mock_for_state: (),
|
||||
|
|
|
@ -596,6 +596,7 @@ pub(crate) mod test {
|
|||
guardmgr,
|
||||
)
|
||||
.unwrap();
|
||||
let circpool = HsCircPool::new(&circmgr);
|
||||
let netdir_provider = tor_netdir::testprovider::TestNetDirProvider::new();
|
||||
let netdir_provider = Arc::new(netdir_provider);
|
||||
let (give_send, give) = postage::watch::channel_with(Ready(Ok(())));
|
||||
|
@ -603,7 +604,7 @@ pub(crate) mod test {
|
|||
#[allow(clippy::let_and_return)] // we'll probably add more in this function
|
||||
let hscc = HsClientConnector {
|
||||
runtime,
|
||||
circmgr,
|
||||
circpool,
|
||||
netdir_provider,
|
||||
services: Default::default(),
|
||||
mock_for_state,
|
||||
|
|
Loading…
Reference in New Issue