From f17a6616b2cea40aac78aafbe1729d099f5a8742 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 24 Jun 2017 17:09:28 +0000 Subject: [PATCH] runtime: ensure management interface buffer can hold log buffer. Otherwise we get weird edge cases where the network stack could try to append to log buffer while management interface is holding the log buffer and trying to push it out, and it's just no good. The serialized log buffer at its maximum length is slightly longer than 32 KiB, so we just allocate the largest possible TCP buffer to the management interface to keep it simple. --- artiq/firmware/runtime/lib.rs | 2 +- artiq/firmware/runtime/mgmt.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index c9cc36315..d62488153 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -176,7 +176,7 @@ pub extern fn main() -> i32 { panic!("out of memory"); }); - static mut LOG_BUFFER: [u8; 65536] = [0; 65536]; + static mut LOG_BUFFER: [u8; 32768] = [0; 32768]; logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup); 0 } diff --git a/artiq/firmware/runtime/mgmt.rs b/artiq/firmware/runtime/mgmt.rs index 13fb808af..32fed0b2d 100644 --- a/artiq/firmware/runtime/mgmt.rs +++ b/artiq/firmware/runtime/mgmt.rs @@ -69,7 +69,7 @@ fn worker(mut stream: &mut TcpStream) -> io::Result<()> { } pub fn thread(io: Io) { - let listener = TcpListener::new(&io, 4096); + let listener = TcpListener::new(&io, 65535); listener.listen(1380).expect("mgmt: cannot listen"); info!("management interface active");