From 869a3c43baae008b50c487d1c4213c98518fe207 Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Thu, 6 Oct 2022 14:52:06 +0200 Subject: [PATCH] try https://github.com/tower-rs/tower/issues/547 fix --- iroh-rpc-types/src/connection_pool.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/iroh-rpc-types/src/connection_pool.rs b/iroh-rpc-types/src/connection_pool.rs index 5d6f545d8b..4b34d28ec0 100644 --- a/iroh-rpc-types/src/connection_pool.rs +++ b/iroh-rpc-types/src/connection_pool.rs @@ -93,11 +93,12 @@ impl Service> for TonicConnectionPool { } fn call(&mut self, request: tonic::codegen::http::Request) -> Self::Future { - let this = self.clone(); + let this = self.inner.clone(); + let inner = std::mem::replace(&mut self.inner, this); // TODO: error handling let fut = Box::pin(async move { - let conn = &mut *this.inner.get().await.unwrap(); - Service::call(conn, request).await + let mut conn = inner.get().await.unwrap(); + Service::call(&mut *conn, request).await }); // TODO: avoid box ResponseFuture { inner: fut }