refactor: improve flow
This commit is contained in:
parent
ae854b395f
commit
87f1ed675a
@ -412,6 +412,8 @@ pub async fn call<'a, T: hyper::client::connect::Connect + Clone + Send + Sync +
|
|||||||
.expect("response does not have an upgrade extension")
|
.expect("response does not have an upgrade extension")
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
debug!("Responding to a connection upgrade response");
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut request_upgraded = request_upgraded
|
let mut request_upgraded = request_upgraded
|
||||||
.expect("request does not have an upgrade extension")
|
.expect("request does not have an upgrade extension")
|
||||||
@ -423,13 +425,13 @@ pub async fn call<'a, T: hyper::client::connect::Connect + Clone + Send + Sync +
|
|||||||
.expect("coping between upgraded connections failed");
|
.expect("coping between upgraded connections failed");
|
||||||
});
|
});
|
||||||
|
|
||||||
return Ok(response);
|
Ok(response)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
let proxied_response = create_proxied_response(response);
|
let proxied_response = create_proxied_response(response);
|
||||||
|
|
||||||
debug!("Responding to call with response");
|
debug!("Responding to call with response");
|
||||||
Ok(proxied_response)
|
Ok(proxied_response)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ReverseProxy<T: hyper::client::connect::Connect + Clone + Send + Sync + 'static> {
|
pub struct ReverseProxy<T: hyper::client::connect::Connect + Clone + Send + Sync + 'static> {
|
||||||
|
Loading…
Reference in New Issue
Block a user