fix: be less verbose with successful sockets

This commit is contained in:
Mahdi Dibaiee 2021-03-15 09:11:53 +00:00
parent a169d72698
commit be3f8f4cff

View File

@ -62,7 +62,7 @@ async fn proxy(mut incoming: TcpStream) -> Result<(), Box<dyn Error>> {
let mut req = Request::new(&mut headers); let mut req = Request::new(&mut headers);
req.parse(&buf).unwrap(); req.parse(&buf).unwrap();
println!("buf {:#?}", str::from_utf8(&buf)?); println!("{}\r\n------", str::from_utf8(&buf)?);
match (req.method, req.path) { match (req.method, req.path) {
(Some("CONNECT"), Some(ref path)) => { (Some("CONNECT"), Some(ref path)) => {
@ -112,9 +112,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let (tcp_stream, _) = tcp_listener.accept().await?; let (tcp_stream, _) = tcp_listener.accept().await?;
tokio::task::spawn(async move { tokio::task::spawn(async move {
match proxy(tcp_stream).await { match proxy(tcp_stream).await {
Ok(()) => { Ok(()) => {}
println!("One socket processed successfully.");
}
Err(e) => { Err(e) => {
println!("error: {:#?}", e); println!("error: {:#?}", e);
} }