forked from M-Labs/artiq-zynq
comms,mgmt: log connections as soon as they arrive
This commit is contained in:
parent
8c60947291
commit
0b47ac75f0
|
@ -266,7 +266,6 @@ async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Contr
|
||||||
if !expect(stream, b"ARTIQ coredev\n").await? {
|
if !expect(stream, b"ARTIQ coredev\n").await? {
|
||||||
return Err(Error::UnexpectedPattern);
|
return Err(Error::UnexpectedPattern);
|
||||||
}
|
}
|
||||||
info!("received connection");
|
|
||||||
loop {
|
loop {
|
||||||
let request = read_request(stream, true).await?;
|
let request = read_request(stream, true).await?;
|
||||||
if request.is_none() {
|
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 stream = TcpStream::accept(1381, 2048, 2048).await.unwrap();
|
||||||
let control = control.clone();
|
let control = control.clone();
|
||||||
task::spawn(async {
|
task::spawn(async {
|
||||||
|
info!("received connection");
|
||||||
let _ = handle_connection(&stream, control)
|
let _ = handle_connection(&stream, control)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| warn!("connection terminated: {}", e));
|
.map_err(|e| warn!("connection terminated: {}", e));
|
||||||
|
|
|
@ -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> {
|
async fn handle_connection(stream: &mut TcpStream, pull_id: Rc<RefCell<u32>>) -> Result<(), Error> {
|
||||||
Request::read_magic(stream).await?;
|
Request::read_magic(stream).await?;
|
||||||
info!("received connection");
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let req = Request::read_from(stream).await;
|
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 mut stream = TcpStream::accept(1380, 2048, 2048).await.unwrap();
|
||||||
let pull_id = pull_id.clone();
|
let pull_id = pull_id.clone();
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
|
info!("received connection");
|
||||||
let _ = handle_connection(&mut stream, pull_id)
|
let _ = handle_connection(&mut stream, pull_id)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| warn!("connection terminated: {:?}", e));
|
.map_err(|e| warn!("connection terminated: {:?}", e));
|
||||||
|
|
Loading…
Reference in New Issue