forked from M-Labs/nac3
1
0
Fork 0

comms,mgmt: log connections as soon as they arrive

This commit is contained in:
Sebastien Bourdeauducq 2020-07-20 19:09:56 +08:00
parent 8c60947291
commit 0b47ac75f0
2 changed files with 2 additions and 2 deletions

View File

@ -266,7 +266,6 @@ async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Contr
if !expect(stream, b"ARTIQ coredev\n").await? {
return Err(Error::UnexpectedPattern);
}
info!("received connection");
loop {
let request = read_request(stream, true).await?;
if request.is_none() {
@ -355,6 +354,7 @@ pub fn main(timer: GlobalTimer, cfg: &config::Config) {
let stream = TcpStream::accept(1381, 2048, 2048).await.unwrap();
let control = control.clone();
task::spawn(async {
info!("received connection");
let _ = handle_connection(&stream, control)
.await
.map_err(|e| warn!("connection terminated: {}", e));

View File

@ -33,7 +33,6 @@ async fn get_logger_buffer() -> LogBufferRef<'static> {
async fn handle_connection(stream: &mut TcpStream, pull_id: Rc<RefCell<u32>>) -> Result<(), Error> {
Request::read_magic(stream).await?;
info!("received connection");
loop {
let req = Request::read_from(stream).await;
@ -104,6 +103,7 @@ pub fn start() {
let mut stream = TcpStream::accept(1380, 2048, 2048).await.unwrap();
let pull_id = pull_id.clone();
task::spawn(async move {
info!("received connection");
let _ = handle_connection(&mut stream, pull_id)
.await
.map_err(|e| warn!("connection terminated: {:?}", e));