Skip to content

Commit

Permalink
chore(misc): allow Body::channel() deprecation
Browse files Browse the repository at this point in the history
see linkerd/linkerd2#8733.

`Body::channel()` is no longer exposed in hyper's 1.0 release.

this commit adds `#[allow(deprecated)]` attributes. an upstream patch
will mark this as deprecated.

* linkerd/linkerd2#8733
* hyperium/hyper#2962
* hyperium/hyper#2970

Signed-off-by: katelyn martin <kate@buoyant.io>
  • Loading branch information
cratelyn committed Dec 20, 2024
1 parent fcfde84 commit 1b97da9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions linkerd/app/admin/src/server/log/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ where
// https://github.com/hawkw/thingbuf/issues/62 would allow us to avoid the
// copy by passing the channel's pooled buffer directly to hyper, and
// returning it to the channel to be reused when hyper is done with it.
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::Body::channel();
tokio::spawn(
async move {
Expand Down
1 change: 1 addition & 0 deletions linkerd/app/inbound/src/http/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ fn grpc_status_server(
server_io,
hyper::service::service_fn(move |request: Request<hyper::Body>| async move {
tracing::info!(?request);
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, rx) = hyper::Body::channel();
tokio::spawn(async move {
let mut trls = ::http::HeaderMap::new();
Expand Down
5 changes: 5 additions & 0 deletions linkerd/app/integration/src/tests/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ mod cross_version {
.await;

let client = test.client;
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::body::Body::channel();
let req = client
.request_builder("/0.5")
Expand Down Expand Up @@ -386,6 +387,7 @@ mod cross_version {
.await;

let client = test.client;
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::body::Body::channel();
let req = client
.request_builder("/0.5")
Expand Down Expand Up @@ -661,6 +663,7 @@ mod grpc_retry {
let mut trailers = HeaderMap::with_capacity(1);
trailers.insert(GRPC_STATUS.clone(), status);
tracing::debug!(?trailers);
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::body::Body::channel();
tx.send_trailers(trailers).await.unwrap();
Ok::<_, Error>(Response::builder().status(200).body(body).unwrap())
Expand Down Expand Up @@ -704,6 +707,7 @@ mod grpc_retry {
let mut trailers = HeaderMap::with_capacity(1);
trailers.insert(GRPC_STATUS.clone(), GRPC_STATUS_OK.clone());
tracing::debug!(?trailers);
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::body::Body::channel();
tx.send_data("hello world".into()).await.unwrap();
tx.send_trailers(trailers).await.unwrap();
Expand Down Expand Up @@ -752,6 +756,7 @@ mod grpc_retry {
let mut trailers = HeaderMap::with_capacity(1);
trailers.insert(GRPC_STATUS.clone(), GRPC_STATUS_OK.clone());
tracing::debug!(?trailers);
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::body::Body::channel();
tokio::spawn(async move {
tx.send_data("hello".into()).await.unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ async fn body_data_layer_records_frames() -> Result<(), Error> {
// Create a response whose body is backed by a channel that we can send chunks to, send it.
tracing::info!("sending response");
let mut resp_tx = {
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (tx, body) = hyper::Body::channel();
let body = BoxBody::new(body);
let resp = http::Response::builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ async fn http_route_request_body_frames() {
// Create a request whose body is backed by a channel that we can send chunks to.
tracing::info!("creating request");
let (req, tx) = {
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (tx, body) = hyper::Body::channel();
let body = BoxBody::new(body);
let req = http::Request::builder()
Expand Down
4 changes: 4 additions & 0 deletions linkerd/http/retry/src/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ mod tests {
// initial body will complete, but the replay will immediately fail.
let _trace = linkerd_tracing::test::with_default_filter("linkerd_http_retry=trace");

#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::Body::channel();
let mut initial = ReplayBody::try_new(body, 8).expect("channel body must not be too large");
let mut replay = initial.clone();
Expand Down Expand Up @@ -859,6 +860,7 @@ mod tests {
// cap, we allow the request to continue, but stop buffering.
let _trace = linkerd_tracing::test::with_default_filter("linkerd_http_retry=debug");

#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (mut tx, body) = hyper::Body::channel();
let mut initial = ReplayBody::try_new(body, 8).expect("channel body must not be too large");
let mut replay = initial.clone();
Expand Down Expand Up @@ -907,6 +909,7 @@ mod tests {
"over-sized body is too big"
);

#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (_sender, body) = hyper::Body::channel();
assert!(
ReplayBody::try_new(body, max_size).is_ok(),
Expand All @@ -925,6 +928,7 @@ mod tests {

impl Test {
fn new() -> Self {
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (tx, body) = hyper::Body::channel();
let initial = ReplayBody::try_new(body, 64 * 1024).expect("body too large");
let replay = initial.clone();
Expand Down
1 change: 1 addition & 0 deletions linkerd/proxy/http/src/server/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ impl TestServer {
_ = (&mut call0) => unreachable!("client cannot receive a response"),
next = self.server.next_request() => next.expect("server not dropped"),
};
#[allow(deprecated, reason = "linkerd/linkerd2#8733")]
let (tx, rx) = hyper::Body::channel();
next.send_response(http::Response::new(BoxBody::new(rx)));
let rsp = call0.await.expect("response");
Expand Down

0 comments on commit 1b97da9

Please sign in to comment.