diff --git a/src/server.rs b/src/server.rs index 25dd063..09e2bb0 100644 --- a/src/server.rs +++ b/src/server.rs @@ -168,6 +168,13 @@ where let server = self.clone(); let listener_clone = listener.clone(); + let s = server.clone(); + let conn = Connection { + consensus: s.consensus.clone(), + mempool: s.mempool.clone(), + info: s.info.clone(), + snapshot: s.snapshot.clone(), + }; tokio::spawn(async move { let s = server.clone(); backoff::future::retry::<_, BoxError, _, _, _>( @@ -175,12 +182,6 @@ where || async { match listener_clone.accept().await { Ok((socket, _addr)) => { - let conn = Connection { - consensus: s.consensus.clone(), - mempool: s.mempool.clone(), - info: s.info.clone(), - snapshot: s.snapshot.clone(), - }; if let Err(e) = conn.run(socket).await { match e.downcast::() {