Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Oct 18, 2022
1 parent f15c4f2 commit 869a3c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions iroh-rpc-types/src/connection_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ impl Service<tonic::codegen::http::Request<BoxBody>> for TonicConnectionPool {
}

fn call(&mut self, request: tonic::codegen::http::Request<BoxBody>) -> 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 }
Expand Down

0 comments on commit 869a3c4

Please sign in to comment.