forked from M-Labs/artiq
firmware: accept sessions even when startup kernel is running.
Fixes #625. Fixes #649.
This commit is contained in:
parent
24ce9a057b
commit
6891b5fcfd
|
@ -639,27 +639,33 @@ fn respawn<F>(io: &Io, handle: &mut Option<ThreadHandle>, f: F)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn thread(io: Io) {
|
pub fn thread(io: Io) {
|
||||||
let congress = Urc::new(RefCell::new(Congress::new()));
|
|
||||||
|
|
||||||
info!("running startup kernel");
|
|
||||||
match flash_kernel_worker(&io, &mut *borrow_mut!(congress), "startup_kernel") {
|
|
||||||
Ok(()) => info!("startup kernel finished"),
|
|
||||||
Err(err) => {
|
|
||||||
if err.kind() == io::ErrorKind::NotFound {
|
|
||||||
info!("no startup kernel found")
|
|
||||||
} else {
|
|
||||||
error!("startup kernel aborted: {}", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferLogger::with_instance(|logger| logger.disable_trace_to_uart());
|
|
||||||
|
|
||||||
let listener = TcpListener::new(&io, 65535);
|
let listener = TcpListener::new(&io, 65535);
|
||||||
listener.listen(1381).expect("session: cannot listen");
|
listener.listen(1381).expect("session: cannot listen");
|
||||||
info!("accepting network sessions");
|
info!("accepting network sessions");
|
||||||
|
|
||||||
|
BufferLogger::with_instance(|logger| logger.disable_trace_to_uart());
|
||||||
|
|
||||||
|
let congress = Urc::new(RefCell::new(Congress::new()));
|
||||||
|
|
||||||
let mut kernel_thread = None;
|
let mut kernel_thread = None;
|
||||||
|
{
|
||||||
|
let congress = congress.clone();
|
||||||
|
respawn(&io, &mut kernel_thread, move |io| {
|
||||||
|
let mut congress = borrow_mut!(congress);
|
||||||
|
info!("running startup kernel");
|
||||||
|
match flash_kernel_worker(&io, &mut congress, "startup_kernel") {
|
||||||
|
Ok(()) => info!("startup kernel finished"),
|
||||||
|
Err(err) => {
|
||||||
|
if err.kind() == io::ErrorKind::NotFound {
|
||||||
|
info!("no startup kernel found")
|
||||||
|
} else {
|
||||||
|
error!("startup kernel aborted: {}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if listener.can_accept() {
|
if listener.can_accept() {
|
||||||
let mut stream = listener.accept().expect("session: cannot accept");
|
let mut stream = listener.accept().expect("session: cannot accept");
|
||||||
|
|
Loading…
Reference in New Issue