From e17dc0172b72d444d4135b308551a82dd20e3fa5 Mon Sep 17 00:00:00 2001 From: glendc Date: Sat, 9 Nov 2024 09:54:02 +0100 Subject: [PATCH] revert h2 clone: mutex once again --- rama-http-backend/src/client/conn.rs | 2 +- rama-http-backend/src/client/svc.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rama-http-backend/src/client/conn.rs b/rama-http-backend/src/client/conn.rs index 683a9332..9331e308 100644 --- a/rama-http-backend/src/client/conn.rs +++ b/rama-http-backend/src/client/conn.rs @@ -116,7 +116,7 @@ where } }); - let svc = HttpClientService(SendRequest::Http2(sender)); + let svc = HttpClientService(SendRequest::Http2(Mutex::new(sender))); Ok(EstablishedClientConnection { ctx, diff --git a/rama-http-backend/src/client/svc.rs b/rama-http-backend/src/client/svc.rs index c2fa5620..42e80d80 100644 --- a/rama-http-backend/src/client/svc.rs +++ b/rama-http-backend/src/client/svc.rs @@ -14,10 +14,10 @@ use tokio::sync::Mutex; #[derive(Debug)] // TODO: once we have hyper as `rama_core` we can -// drop the cloning / mutex / something approach as we can operate on reference layer +// drop this mutex as there is no inherint reason for `sender` to be mutable... pub(super) enum SendRequest { Http1(Mutex>), - Http2(hyper::client::conn::http2::SendRequest), + Http2(Mutex>), } #[derive(Debug)] @@ -49,7 +49,7 @@ where let resp = match &self.0 { SendRequest::Http1(sender) => sender.lock().await.send_request(req).await, - SendRequest::Http2(sender) => sender.clone().send_request(req).await, + SendRequest::Http2(sender) => sender.lock().await().send_request(req).await, }?; Ok(resp.map(rama_http_types::Body::new))