diff --git a/src/flowgate/server.rs b/src/flowgate/server.rs index 68b01da..715eeb9 100755 --- a/src/flowgate/server.rs +++ b/src/flowgate/server.rs @@ -29,16 +29,6 @@ pub struct FlowgateServer { config: Arc>, } -pub trait Closeable { - fn close(&mut self); -} - -impl Closeable for TcpStream { - fn close(&mut self) { - let _ = self.shutdown(); - } -} - struct Connection { stream: TcpStream, config: SiteConfig, @@ -146,14 +136,14 @@ impl FlowgateServer { if conn.keep_alive && conn.config.enable_keep_alive { loop { if !conn.config.support_keep_alive { - conn.stream.close(); + conn.stream.shutdown().await.ignore(); conn.stream = conn.config.connect().await?; } conn = read_request(config.clone(), stream, addr, https, Some(conn)).await?; } } - conn.stream.close(); + conn.stream.shutdown().await.ignore(); stream.shutdown().await.ok()?; Some(())