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.
This commit is contained in:
whitequark 2017-06-24 17:09:28 +00:00
parent d0f72632e1
commit f17a6616b2
2 changed files with 2 additions and 2 deletions

View File

@ -176,7 +176,7 @@ pub extern fn main() -> i32 {
panic!("out of memory"); 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); logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup);
0 0
} }

View File

@ -69,7 +69,7 @@ fn worker(mut stream: &mut TcpStream) -> io::Result<()> {
} }
pub fn thread(io: Io) { pub fn thread(io: Io) {
let listener = TcpListener::new(&io, 4096); let listener = TcpListener::new(&io, 65535);
listener.listen(1380).expect("mgmt: cannot listen"); listener.listen(1380).expect("mgmt: cannot listen");
info!("management interface active"); info!("management interface active");