remove closeable and more ignore trait!!!
This commit is contained in:
parent
37c6122f87
commit
013ddd4944
@ -29,16 +29,6 @@ pub struct FlowgateServer {
|
|||||||
config: Arc<RwLock<Config>>,
|
config: Arc<RwLock<Config>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Closeable {
|
|
||||||
fn close(&mut self);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Closeable for TcpStream {
|
|
||||||
fn close(&mut self) {
|
|
||||||
let _ = self.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Connection {
|
struct Connection {
|
||||||
stream: TcpStream,
|
stream: TcpStream,
|
||||||
config: SiteConfig,
|
config: SiteConfig,
|
||||||
@ -146,14 +136,14 @@ impl FlowgateServer {
|
|||||||
if conn.keep_alive && conn.config.enable_keep_alive {
|
if conn.keep_alive && conn.config.enable_keep_alive {
|
||||||
loop {
|
loop {
|
||||||
if !conn.config.support_keep_alive {
|
if !conn.config.support_keep_alive {
|
||||||
conn.stream.close();
|
conn.stream.shutdown().await.ignore();
|
||||||
conn.stream = conn.config.connect().await?;
|
conn.stream = conn.config.connect().await?;
|
||||||
}
|
}
|
||||||
conn = read_request(config.clone(), stream, addr, https, Some(conn)).await?;
|
conn = read_request(config.clone(), stream, addr, https, Some(conn)).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.stream.close();
|
conn.stream.shutdown().await.ignore();
|
||||||
stream.shutdown().await.ok()?;
|
stream.shutdown().await.ok()?;
|
||||||
|
|
||||||
Some(())
|
Some(())
|
||||||
|
Loading…
Reference in New Issue
Block a user