mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-05 14:20:21 +00:00
async-recursion removed
This commit is contained in:
parent
18044a8056
commit
c1d93942cc
2 changed files with 5 additions and 6 deletions
|
@ -8,12 +8,12 @@ homepage = "https://github.com/blechschmidt/tun2proxy"
|
||||||
authors = ["B. Blechschmidt", "ssrlive"]
|
authors = ["B. Blechschmidt", "ssrlive"]
|
||||||
description = "Tunnel interface to proxy"
|
description = "Tunnel interface to proxy"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
rust-version = "1.77"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["staticlib", "cdylib", "lib"]
|
crate-type = ["staticlib", "cdylib", "lib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-recursion = "1.1"
|
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
base64 = { version = "0.22" }
|
base64 = { version = "0.22" }
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
|
|
@ -152,7 +152,6 @@ impl HttpConnection {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_recursion::async_recursion]
|
|
||||||
async fn state_change(&mut self) -> Result<()> {
|
async fn state_change(&mut self) -> Result<()> {
|
||||||
match self.state {
|
match self.state {
|
||||||
HttpState::ExpectResponseHeaders => {
|
HttpState::ExpectResponseHeaders => {
|
||||||
|
@ -200,7 +199,7 @@ impl HttpConnection {
|
||||||
// The server may have sent a banner already (SMTP, SSH, etc.).
|
// The server may have sent a banner already (SMTP, SSH, etc.).
|
||||||
// Therefore, server_inbuf must retain this data.
|
// Therefore, server_inbuf must retain this data.
|
||||||
self.server_inbuf.drain(0..header_size);
|
self.server_inbuf.drain(0..header_size);
|
||||||
return self.state_change().await;
|
return Box::pin(self.state_change()).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
if status_code != 407 {
|
if status_code != 407 {
|
||||||
|
@ -295,7 +294,7 @@ impl HttpConnection {
|
||||||
self.state = HttpState::ExpectResponse;
|
self.state = HttpState::ExpectResponse;
|
||||||
self.skip = content_length + len;
|
self.skip = content_length + len;
|
||||||
|
|
||||||
return self.state_change().await;
|
return Box::pin(self.state_change()).await;
|
||||||
}
|
}
|
||||||
HttpState::ExpectResponse => {
|
HttpState::ExpectResponse => {
|
||||||
if self.skip > 0 {
|
if self.skip > 0 {
|
||||||
|
@ -312,7 +311,7 @@ impl HttpConnection {
|
||||||
self.send_tunnel_request().await?;
|
self.send_tunnel_request().await?;
|
||||||
self.state = HttpState::ExpectResponseHeaders;
|
self.state = HttpState::ExpectResponseHeaders;
|
||||||
|
|
||||||
return self.state_change().await;
|
return Box::pin(self.state_change()).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HttpState::Established => {
|
HttpState::Established => {
|
||||||
|
@ -323,7 +322,7 @@ impl HttpConnection {
|
||||||
}
|
}
|
||||||
HttpState::Reset => {
|
HttpState::Reset => {
|
||||||
self.state = HttpState::ExpectResponseHeaders;
|
self.state = HttpState::ExpectResponseHeaders;
|
||||||
return self.state_change().await;
|
return Box::pin(self.state_change()).await;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue