From 1c67ff50e39b0650f93acdaba35dfd29110a0537 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 17 Apr 2020 14:43:14 +0800 Subject: [PATCH] close connections --- runtime/src/comms.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/src/comms.rs b/runtime/src/comms.rs index cf5cc881..651ff7e7 100644 --- a/runtime/src/comms.rs +++ b/runtime/src/comms.rs @@ -141,7 +141,7 @@ async fn send_header(stream: &TcpStream, reply: Reply) -> Result<()> { Ok(()) } -async fn handle_connection(stream: TcpStream, control: Rc>>) -> Result<()> { +async fn handle_connection(stream: &TcpStream, control: Rc>) -> Result<()> { expect(&stream, b"ARTIQ coredev\n").await?; loop { expect(&stream, &[0x5a, 0x5a, 0x5a, 0x5a]).await?; @@ -224,9 +224,11 @@ pub fn main() { while let stream = TcpStream::accept(1381, 2048, 2048).await.unwrap() { let control = control.clone(); task::spawn(async { - let _ = handle_connection(stream, control) + let _ = handle_connection(&stream, control) .await .map_err(|e| println!("Connection: {}", e)); + let _ = stream.flush().await; + let _ = stream.abort().await; }); } }