Skip to content

Commit

Permalink
revert h2 clone: mutex once again
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenDC committed Nov 9, 2024
1 parent ad2cfbf commit e17dc01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rama-http-backend/src/client/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ where
}
});

let svc = HttpClientService(SendRequest::Http2(sender));
let svc = HttpClientService(SendRequest::Http2(Mutex::new(sender)));

Ok(EstablishedClientConnection {
ctx,
Expand Down
6 changes: 3 additions & 3 deletions rama-http-backend/src/client/svc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Body> {
Http1(Mutex<hyper::client::conn::http1::SendRequest<Body>>),
Http2(hyper::client::conn::http2::SendRequest<Body>),
Http2(Mutex<hyper::client::conn::http2::SendRequest<Body>>),
}

#[derive(Debug)]
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit e17dc01

Please sign in to comment.