tor-circmgr: Don't clone parameters in create_chantarget()

This commit is contained in:
Neel Chauhan 2021-12-25 17:22:38 -08:00
parent 12045cb454
commit 383843f0d7
3 changed files with 5 additions and 5 deletions

View File

@ -101,8 +101,7 @@ impl Buildable for Arc<ClientCirc> {
params: &CircParameters,
) -> Result<Self> {
let circ = create_common(chanmgr, rt, rng, ct).await?;
// FIXME(eta): don't clone the params?
Ok(Arc::new(circ.create_firsthop_fast(params.clone()).await?))
Ok(Arc::new(circ.create_firsthop_fast(params).await?))
}
async fn create<RNG: CryptoRng + Rng + Send, RT: Runtime>(
chanmgr: &ChanMgr<RT>,

View File

@ -532,7 +532,8 @@ pub(crate) mod test {
reactor.run_once().await.unwrap();
};
let (circ, _) = futures::join!(pending.create_firsthop_fast(circparams), send_response);
let (circ, _) =
futures::join!(pending.create_firsthop_fast(&circparams), send_response);
// Make sure statuses are as expected.
assert!(matches!(circ.err().unwrap(), Error::BadHandshake));

View File

@ -453,7 +453,7 @@ impl PendingClientCirc {
/// There's no authentication in CRATE_FAST,
/// so we don't need to know whom we're connecting to: we're just
/// connecting to whichever relay the channel is for.
pub async fn create_firsthop_fast(self, params: CircParameters) -> Result<ClientCirc> {
pub async fn create_firsthop_fast(self, params: &CircParameters) -> Result<ClientCirc> {
let (tx, rx) = oneshot::channel();
self.circ
.control
@ -747,7 +747,7 @@ mod test {
let params = CircParameters::default();
let ret = if fast {
trace!("doing fast create");
pending.create_firsthop_fast(params).await
pending.create_firsthop_fast(&params).await
} else {
trace!("doing ntor create");
pending.create_firsthop_ntor(&target, params).await