-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes all re-attempts present in monero-serai's RPC and is an attempt to narrow down the sporadic failures. Inspired by hyperium/hyper#3427
- Loading branch information
1 parent
d1122a6
commit 7dc7f8f
Showing
16 changed files
with
342 additions
and
123 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
use hyper::{ | ||
StatusCode, | ||
header::{HeaderValue, HeaderMap}, | ||
body::{Buf, Body}, | ||
body::{Buf, Incoming}, | ||
}; | ||
use http_body_util::BodyExt; | ||
|
||
use crate::{Client, Error}; | ||
use crate::Error; | ||
|
||
// Borrows the client so its async task lives as long as this response exists. | ||
#[derive(Debug)] | ||
pub struct Response<'a>(pub(crate) hyper::Response<Body>, pub(crate) &'a Client); | ||
impl<'a> Response<'a> { | ||
pub struct Response(pub(crate) hyper::Response<Incoming>); | ||
impl Response { | ||
pub fn status(&self) -> StatusCode { | ||
self.0.status() | ||
} | ||
pub fn headers(&self) -> &HeaderMap<HeaderValue> { | ||
self.0.headers() | ||
} | ||
pub async fn body(self) -> Result<impl std::io::Read, Error> { | ||
hyper::body::aggregate(self.0.into_body()).await.map(Buf::reader).map_err(Error::Hyper) | ||
self | ||
.0 | ||
.into_body() | ||
.collect() | ||
.await | ||
.map_err(Error::Hyper) | ||
.map(|collected| Buf::reader(collected.aggregate())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.