Skip to content

Commit

Permalink
Merge branch 'main' into feat/rama-http-core
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenDC committed Nov 8, 2024
2 parents c794d0c + 932086e commit 3bd745a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
25 changes: 12 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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(Mutex::new(sender)));
let svc = HttpClientService(SendRequest::Http2(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 this mutex as there is no inherint reason for `sender` to be mutable...
// drop the cloning / mutex / something approach as we can operate on reference layer
pub(super) enum SendRequest<Body> {
Http1(Mutex<hyper::client::conn::http1::SendRequest<Body>>),
Http2(Mutex<hyper::client::conn::http2::SendRequest<Body>>),
Http2(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.lock().await.send_request(req).await,
SendRequest::Http2(sender) => sender.clone().send_request(req).await,
}?;

Ok(resp.map(rama_http_types::Body::new))
Expand Down

0 comments on commit 3bd745a

Please sign in to comment.