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,10 +639,21 @@ fn respawn<F>(io: &Io, handle: &mut Option<ThreadHandle>, f: F)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn thread(io: Io) {
|
pub fn thread(io: Io) {
|
||||||
|
let listener = TcpListener::new(&io, 65535);
|
||||||
|
listener.listen(1381).expect("session: cannot listen");
|
||||||
|
info!("accepting network sessions");
|
||||||
|
|
||||||
|
BufferLogger::with_instance(|logger| logger.disable_trace_to_uart());
|
||||||
|
|
||||||
let congress = Urc::new(RefCell::new(Congress::new()));
|
let congress = Urc::new(RefCell::new(Congress::new()));
|
||||||
|
|
||||||
|
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");
|
info!("running startup kernel");
|
||||||
match flash_kernel_worker(&io, &mut *borrow_mut!(congress), "startup_kernel") {
|
match flash_kernel_worker(&io, &mut congress, "startup_kernel") {
|
||||||
Ok(()) => info!("startup kernel finished"),
|
Ok(()) => info!("startup kernel finished"),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
if err.kind() == io::ErrorKind::NotFound {
|
if err.kind() == io::ErrorKind::NotFound {
|
||||||
|
@ -652,14 +663,9 @@ pub fn thread(io: Io) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
BufferLogger::with_instance(|logger| logger.disable_trace_to_uart());
|
|
||||||
|
|
||||||
let listener = TcpListener::new(&io, 65535);
|
|
||||||
listener.listen(1381).expect("session: cannot listen");
|
|
||||||
info!("accepting network sessions");
|
|
||||||
|
|
||||||
let mut kernel_thread = None;
|
|
||||||
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