async-recursion removed

This commit is contained in:
ssrlive 2024-04-08 14:24:41 +08:00
parent 18044a8056
commit c1d93942cc
2 changed files with 5 additions and 6 deletions

View file

@ -152,7 +152,6 @@ impl HttpConnection {
Ok(())
}
#[async_recursion::async_recursion]
async fn state_change(&mut self) -> Result<()> {
match self.state {
HttpState::ExpectResponseHeaders => {
@ -200,7 +199,7 @@ impl HttpConnection {
// The server may have sent a banner already (SMTP, SSH, etc.).
// Therefore, server_inbuf must retain this data.
self.server_inbuf.drain(0..header_size);
return self.state_change().await;
return Box::pin(self.state_change()).await;
}
if status_code != 407 {
@ -295,7 +294,7 @@ impl HttpConnection {
self.state = HttpState::ExpectResponse;
self.skip = content_length + len;
return self.state_change().await;
return Box::pin(self.state_change()).await;
}
HttpState::ExpectResponse => {
if self.skip > 0 {
@ -312,7 +311,7 @@ impl HttpConnection {
self.send_tunnel_request().await?;
self.state = HttpState::ExpectResponseHeaders;
return self.state_change().await;
return Box::pin(self.state_change()).await;
}
}
HttpState::Established => {
@ -323,7 +322,7 @@ impl HttpConnection {
}
HttpState::Reset => {
self.state = HttpState::ExpectResponseHeaders;
return self.state_change().await;
return Box::pin(self.state_change()).await;
}
_ => {}
}