1
0
Fork 0

comms: report error on incorrect connection start pattern

This commit is contained in:
Sebastien Bourdeauducq 2020-07-20 19:07:12 +08:00
parent d65e893d1c
commit 4af29e8eca
1 changed files with 3 additions and 1 deletions

View File

@ -263,7 +263,9 @@ async fn load_kernel(buffer: Vec<u8>, control: &Rc<RefCell<kernel::Control>>, st
}
async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Control>>) -> Result<()> {
expect(stream, b"ARTIQ coredev\n").await?;
if !expect(stream, b"ARTIQ coredev\n").await? {
return Err(Error::UnexpectedPattern);
}
info!("received connection");
loop {
let request = read_request(stream, true).await?;