forked from M-Labs/artiq-zynq
Compare commits
11 Commits
remove_red
...
master
Author | SHA1 | Date |
---|---|---|
Simon Renblad | 873dd86b4d | |
Simon Renblad | e7614d2e8e | |
Simon Renblad | 491e426222 | |
Simon Renblad | ccd3bf3003 | |
Sebastien Bourdeauducq | 3fdb7e80a8 | |
abdul124 | bd1de933fb | |
abdul124 | e8d77fca3e | |
abdul124 | 85e8a3fc44 | |
Sebastien Bourdeauducq | 04078b3d89 | |
abdul124 | d508c5c6f8 | |
abdul124 | bae41253e4 |
21
flake.lock
21
flake.lock
|
@ -11,11 +11,11 @@
|
||||||
"src-pythonparser": "src-pythonparser"
|
"src-pythonparser": "src-pythonparser"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722417433,
|
"lastModified": 1724411572,
|
||||||
"narHash": "sha256-QEbcVdL1sUQEbMCvCUvPM8DKqwOth3gJpdiLTf4hPN8=",
|
"narHash": "sha256-33vj/pJ9iaVvaFP8uuBKMSQPN20mRlCbeBkTCNc9WB4=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "0623480c82c28d57e14dc4f363374758a52284d3",
|
"rev": "352cf907ee67f7db5478fe23217cd5fcb7334617",
|
||||||
"revCount": 8952,
|
"revCount": 8996,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/m-labs/artiq.git"
|
"url": "https://github.com/m-labs/artiq.git"
|
||||||
},
|
},
|
||||||
|
@ -102,11 +102,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721924956,
|
"lastModified": 1723362943,
|
||||||
"narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=",
|
"narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5ad6a14c6bf098e98800b091668718c336effc95",
|
"rev": "a58bc8ad779655e790115244571758e8de055e3d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -131,15 +131,16 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722046723,
|
"lastModified": 1719454714,
|
||||||
"narHash": "sha256-G7/gHz8ORRvHd1/RIURrdcswKRPe9K0FsIYR4v5jSWo=",
|
"narHash": "sha256-MojqG0lyUINkEk0b3kM2drsU5vyaF8DFZe/FAlZVOGs=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "56baac5e6b2743d4730e664ea64f6d8a2aad0fbb",
|
"rev": "d1c527659cf076ecc4b96a91c702d080b213801e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
|
"ref": "snapshot/2024-08-01",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
|
||||||
use core_io::Error as ReadError;
|
use core_io::Error as ReadError;
|
||||||
use cslice::CSlice;
|
use cslice::{AsCSlice, CSlice};
|
||||||
use dwarf::eh::{self, EHAction, EHContext};
|
use dwarf::eh::{self, EHAction, EHContext};
|
||||||
use io::{Cursor, ProtoRead};
|
use io::{Cursor, ProtoRead};
|
||||||
use libc::{c_int, c_void, uintptr_t};
|
use libc::{c_int, c_void, uintptr_t};
|
||||||
|
@ -222,8 +222,6 @@ pub unsafe fn artiq_personality(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe extern "C" fn raise(exception: *const Exception) -> ! {
|
pub unsafe extern "C" fn raise(exception: *const Exception) -> ! {
|
||||||
use cslice::AsCSlice;
|
|
||||||
|
|
||||||
let count = EXCEPTION_BUFFER.exception_count;
|
let count = EXCEPTION_BUFFER.exception_count;
|
||||||
let stack = &mut EXCEPTION_BUFFER.exception_stack;
|
let stack = &mut EXCEPTION_BUFFER.exception_stack;
|
||||||
let diff = exception as isize - EXCEPTION_BUFFER.exceptions.as_ptr() as isize;
|
let diff = exception as isize - EXCEPTION_BUFFER.exceptions.as_ptr() as isize;
|
||||||
|
@ -477,20 +475,30 @@ extern "C" fn stop_fn(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be kept in sync with preallocate_runtime_exception_names() in artiq/language/embedding_map.py
|
// Must be kept in sync with preallocate_runtime_exception_names() in `artiq.compiler.embedding`
|
||||||
static EXCEPTION_ID_LOOKUP: [(&str, u32); 12] = [
|
static EXCEPTION_ID_LOOKUP: [(&str, u32); 22] = [
|
||||||
("RuntimeError", 0),
|
("RTIOUnderflow", 0),
|
||||||
("RTIOUnderflow", 1),
|
("RTIOOverflow", 1),
|
||||||
("RTIOOverflow", 2),
|
("RTIODestinationUnreachable", 2),
|
||||||
("RTIODestinationUnreachable", 3),
|
("DMAError", 3),
|
||||||
("DMAError", 4),
|
("I2CError", 4),
|
||||||
("I2CError", 5),
|
("CacheError", 5),
|
||||||
("CacheError", 6),
|
("SPIError", 6),
|
||||||
("SPIError", 7),
|
("SubkernelError", 7),
|
||||||
("ZeroDivisionError", 8),
|
("AssertionError", 8),
|
||||||
("IndexError", 9),
|
("AttributeError", 9),
|
||||||
("UnwrapNoneError", 10),
|
("IndexError", 10),
|
||||||
("SubkernelError", 11),
|
("IOError", 11),
|
||||||
|
("KeyError", 12),
|
||||||
|
("NotImplementedError", 13),
|
||||||
|
("OverflowError", 14),
|
||||||
|
("RuntimeError", 15),
|
||||||
|
("TimeoutError", 16),
|
||||||
|
("TypeError", 17),
|
||||||
|
("ValueError", 18),
|
||||||
|
("ZeroDivisionError", 19),
|
||||||
|
("LinAlgError", 20),
|
||||||
|
("UnwrapNoneError", 21),
|
||||||
];
|
];
|
||||||
|
|
||||||
pub fn get_exception_id(name: &str) -> u32 {
|
pub fn get_exception_id(name: &str) -> u32 {
|
||||||
|
@ -525,3 +533,29 @@ macro_rules! artiq_raise {
|
||||||
}};
|
}};
|
||||||
($name:expr, $message:expr) => {{ artiq_raise!($name, $message, 0, 0, 0) }};
|
($name:expr, $message:expr) => {{ artiq_raise!($name, $message, 0, 0, 0) }};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Takes as input exception id from host
|
||||||
|
/// Generates a new exception with:
|
||||||
|
/// * `id` set to `exn_id`
|
||||||
|
/// * `message` set to corresponding exception name from `EXCEPTION_ID_LOOKUP`
|
||||||
|
///
|
||||||
|
/// The message is matched on host to ensure correct exception is being referred
|
||||||
|
/// This test checks the synchronization of exception ids for runtime errors
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn test_exception_id_sync(exn_id: u32) {
|
||||||
|
let message = EXCEPTION_ID_LOOKUP
|
||||||
|
.iter()
|
||||||
|
.find_map(|&(name, id)| if id == exn_id { Some(name) } else { None })
|
||||||
|
.unwrap_or("unallocated internal exception id");
|
||||||
|
|
||||||
|
let exn = Exception {
|
||||||
|
id: exn_id,
|
||||||
|
file: file!().as_c_slice(),
|
||||||
|
line: 0,
|
||||||
|
column: 0,
|
||||||
|
function: "test_exception_id_sync".as_c_slice(),
|
||||||
|
message: message.as_c_slice(),
|
||||||
|
param: [0, 0, 0],
|
||||||
|
};
|
||||||
|
unsafe { raise(&exn) };
|
||||||
|
}
|
||||||
|
|
|
@ -332,6 +332,13 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
|
||||||
api!(sp_linalg_schur = linalg::sp_linalg_schur),
|
api!(sp_linalg_schur = linalg::sp_linalg_schur),
|
||||||
api!(sp_linalg_hessenberg = linalg::sp_linalg_hessenberg),
|
api!(sp_linalg_hessenberg = linalg::sp_linalg_hessenberg),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* syscall for unit tests
|
||||||
|
* Used in `artiq.tests.coredevice.test_exceptions.ExceptionTest.test_raise_exceptions_kernel`
|
||||||
|
* This syscall checks that the exception IDs used in the Python `EmbeddingMap` (in `artiq.language.embedding`)
|
||||||
|
* match the `EXCEPTION_ID_LOOKUP` defined in the firmware (`libksupport::src::eh_artiq`)
|
||||||
|
*/
|
||||||
|
api!(test_exception_id_sync = eh_artiq::test_exception_id_sync)
|
||||||
];
|
];
|
||||||
api.iter()
|
api.iter()
|
||||||
.find(|&&(exported, _)| exported.as_bytes() == required)
|
.find(|&&(exported, _)| exported.as_bytes() == required)
|
||||||
|
|
|
@ -696,27 +696,6 @@ async fn handle_connection(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn load_and_run_idle_kernel(
|
|
||||||
buffer: &Vec<u8>,
|
|
||||||
control: &Rc<RefCell<kernel::Control>>,
|
|
||||||
up_destinations: &Rc<RefCell<[bool; drtio_routing::DEST_COUNT]>>,
|
|
||||||
aux_mutex: &Rc<Mutex<bool>>,
|
|
||||||
routing_table: &drtio_routing::RoutingTable,
|
|
||||||
timer: GlobalTimer,
|
|
||||||
) {
|
|
||||||
info!("Loading idle kernel");
|
|
||||||
let res = handle_flash_kernel(buffer, control, up_destinations, aux_mutex, routing_table, timer).await;
|
|
||||||
match res {
|
|
||||||
Err(_) => warn!("error loading idle kernel"),
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
info!("Running idle kernel");
|
|
||||||
let _ = handle_run_kernel(None, control, up_destinations, aux_mutex, routing_table, timer)
|
|
||||||
.await
|
|
||||||
.map_err(|_| warn!("error running idle kernel"));
|
|
||||||
info!("Idle kernel terminated");
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main(timer: GlobalTimer, cfg: Config) {
|
pub fn main(timer: GlobalTimer, cfg: Config) {
|
||||||
let net_addresses = net_settings::get_addresses(&cfg);
|
let net_addresses = net_settings::get_addresses(&cfg);
|
||||||
info!("network addresses: {}", net_addresses);
|
info!("network addresses: {}", net_addresses);
|
||||||
|
@ -777,7 +756,6 @@ pub fn main(timer: GlobalTimer, cfg: Config) {
|
||||||
moninj::start(timer, &aux_mutex, &drtio_routing_table);
|
moninj::start(timer, &aux_mutex, &drtio_routing_table);
|
||||||
|
|
||||||
let control: Rc<RefCell<kernel::Control>> = Rc::new(RefCell::new(kernel::Control::start()));
|
let control: Rc<RefCell<kernel::Control>> = Rc::new(RefCell::new(kernel::Control::start()));
|
||||||
let idle_kernel = Rc::new(cfg.read("idle_kernel").ok());
|
|
||||||
if let Ok(buffer) = cfg.read("startup_kernel") {
|
if let Ok(buffer) = cfg.read("startup_kernel") {
|
||||||
info!("Loading startup kernel...");
|
info!("Loading startup kernel...");
|
||||||
let routing_table = drtio_routing_table.borrow();
|
let routing_table = drtio_routing_table.borrow();
|
||||||
|
@ -804,35 +782,26 @@ pub fn main(timer: GlobalTimer, cfg: Config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mgmt::start(cfg);
|
let cfg = Rc::new(cfg);
|
||||||
|
let restart_idle = Rc::new(Semaphore::new(1, 1));
|
||||||
|
mgmt::start(cfg.clone(), restart_idle.clone());
|
||||||
|
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
let connection = Rc::new(Semaphore::new(0, 1));
|
let connection = Rc::new(Semaphore::new(1, 1));
|
||||||
let terminate = Rc::new(Semaphore::new(0, 1));
|
let terminate = Rc::new(Semaphore::new(0, 1));
|
||||||
{
|
let can_restart_idle = Rc::new(Semaphore::new(1, 1));
|
||||||
let control = control.clone();
|
let restart_idle = restart_idle.clone();
|
||||||
let idle_kernel = idle_kernel.clone();
|
|
||||||
let connection = connection.clone();
|
|
||||||
let terminate = terminate.clone();
|
|
||||||
let up_destinations = up_destinations.clone();
|
|
||||||
let aux_mutex = aux_mutex.clone();
|
|
||||||
let routing_table = drtio_routing_table.clone();
|
|
||||||
task::spawn(async move {
|
|
||||||
let routing_table = routing_table.borrow();
|
|
||||||
select_biased! {
|
|
||||||
_ = (async {
|
|
||||||
if let Some(buffer) = &*idle_kernel {
|
|
||||||
load_and_run_idle_kernel(&buffer, &control, &up_destinations, &aux_mutex, &routing_table, timer).await;
|
|
||||||
}
|
|
||||||
}).fuse() => (),
|
|
||||||
_ = terminate.async_wait().fuse() => ()
|
|
||||||
}
|
|
||||||
connection.signal();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let mut stream = TcpStream::accept(1381, 0x10_000, 0x10_000).await.unwrap();
|
let control = control.clone();
|
||||||
|
let mut maybe_stream = select_biased! {
|
||||||
|
s = (async {
|
||||||
|
TcpStream::accept(1381, 0x10_000, 0x10_000).await.unwrap()
|
||||||
|
}).fuse() => Some(s),
|
||||||
|
_ = (async {
|
||||||
|
restart_idle.async_wait().await;
|
||||||
|
can_restart_idle.async_wait().await;
|
||||||
|
}).fuse() => None
|
||||||
|
};
|
||||||
|
|
||||||
if connection.try_wait().is_none() {
|
if connection.try_wait().is_none() {
|
||||||
// there is an existing connection
|
// there is an existing connection
|
||||||
|
@ -840,32 +809,58 @@ pub fn main(timer: GlobalTimer, cfg: Config) {
|
||||||
connection.async_wait().await;
|
connection.async_wait().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let maybe_idle_kernel = cfg.read("idle_kernel").ok();
|
||||||
|
if maybe_idle_kernel.is_none() && maybe_stream.is_none() {
|
||||||
|
control.borrow_mut().restart(); // terminate idle kernel if running
|
||||||
|
}
|
||||||
|
|
||||||
let control = control.clone();
|
let control = control.clone();
|
||||||
let idle_kernel = idle_kernel.clone();
|
|
||||||
let connection = connection.clone();
|
let connection = connection.clone();
|
||||||
let terminate = terminate.clone();
|
let terminate = terminate.clone();
|
||||||
|
let can_restart_idle = can_restart_idle.clone();
|
||||||
let up_destinations = up_destinations.clone();
|
let up_destinations = up_destinations.clone();
|
||||||
let aux_mutex = aux_mutex.clone();
|
let aux_mutex = aux_mutex.clone();
|
||||||
let routing_table = drtio_routing_table.clone();
|
let routing_table = drtio_routing_table.clone();
|
||||||
|
|
||||||
// we make sure the value of terminate is 0 before we start
|
// we make sure the value of terminate is 0 before we start
|
||||||
let _ = terminate.try_wait();
|
let _ = terminate.try_wait();
|
||||||
|
let _ = can_restart_idle.try_wait();
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
let routing_table = routing_table.borrow();
|
let routing_table = routing_table.borrow();
|
||||||
select_biased! {
|
select_biased! {
|
||||||
_ = (async {
|
_ = (async {
|
||||||
let _ = handle_connection(&mut stream, control.clone(), &up_destinations, &aux_mutex, &routing_table, timer)
|
if let Some(stream) = &mut maybe_stream {
|
||||||
.await
|
let _ = handle_connection(stream, control.clone(), &up_destinations, &aux_mutex, &routing_table, timer)
|
||||||
.map_err(|e| warn!("connection terminated: {}", e));
|
.await
|
||||||
if let Some(buffer) = &*idle_kernel {
|
.map_err(|e| warn!("connection terminated: {}", e));
|
||||||
load_and_run_idle_kernel(&buffer, &control, &up_destinations, &aux_mutex, &routing_table, timer).await;
|
}
|
||||||
|
can_restart_idle.signal();
|
||||||
|
match maybe_idle_kernel {
|
||||||
|
Some(buffer) => {
|
||||||
|
loop {
|
||||||
|
info!("loading idle kernel");
|
||||||
|
match handle_flash_kernel(&buffer, &control, &up_destinations, &aux_mutex, &routing_table, timer).await {
|
||||||
|
Ok(_) => {
|
||||||
|
info!("running idle kernel");
|
||||||
|
match handle_run_kernel(None, &control, &up_destinations, &aux_mutex, &routing_table, timer).await {
|
||||||
|
Ok(_) => info!("idle kernel finished"),
|
||||||
|
Err(_) => warn!("idle kernel running error")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(_) => warn!("idle kernel loading error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => info!("no idle kernel found")
|
||||||
}
|
}
|
||||||
}).fuse() => (),
|
}).fuse() => (),
|
||||||
_ = terminate.async_wait().fuse() => ()
|
_ = terminate.async_wait().fuse() => ()
|
||||||
}
|
}
|
||||||
connection.signal();
|
connection.signal();
|
||||||
let _ = stream.flush().await;
|
if let Some(stream) = maybe_stream {
|
||||||
let _ = stream.abort().await;
|
let _ = stream.flush().await;
|
||||||
|
let _ = stream.abort().await;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -914,7 +909,8 @@ pub fn soft_panic_main(timer: GlobalTimer, cfg: Config) -> ! {
|
||||||
|
|
||||||
Sockets::init(32);
|
Sockets::init(32);
|
||||||
|
|
||||||
mgmt::start(cfg);
|
let dummy = Rc::new(Semaphore::new(0, 1));
|
||||||
|
mgmt::start(Rc::new(cfg), dummy);
|
||||||
|
|
||||||
// getting eth settings disables the LED as it resets GPIO
|
// getting eth settings disables the LED as it resets GPIO
|
||||||
// need to re-enable it here
|
// need to re-enable it here
|
||||||
|
|
|
@ -6,6 +6,7 @@ use libasync::{smoltcp::TcpStream, task};
|
||||||
use libboard_artiq::logger::{BufferLogger, LogBufferRef};
|
use libboard_artiq::logger::{BufferLogger, LogBufferRef};
|
||||||
use libboard_zynq::{slcr, smoltcp};
|
use libboard_zynq::{slcr, smoltcp};
|
||||||
use libconfig::Config;
|
use libconfig::Config;
|
||||||
|
use libcortex_a9::semaphore::Semaphore;
|
||||||
use log::{self, debug, error, info, warn, LevelFilter};
|
use log::{self, debug, error, info, warn, LevelFilter};
|
||||||
use num_derive::FromPrimitive;
|
use num_derive::FromPrimitive;
|
||||||
use num_traits::FromPrimitive;
|
use num_traits::FromPrimitive;
|
||||||
|
@ -111,7 +112,12 @@ async fn read_key(stream: &mut TcpStream) -> Result<String> {
|
||||||
Ok(String::from_utf8(buffer).unwrap())
|
Ok(String::from_utf8(buffer).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_connection(stream: &mut TcpStream, pull_id: Rc<RefCell<u32>>, cfg: Rc<Config>) -> Result<()> {
|
async fn handle_connection(
|
||||||
|
stream: &mut TcpStream,
|
||||||
|
pull_id: Rc<RefCell<u32>>,
|
||||||
|
cfg: Rc<Config>,
|
||||||
|
restart_idle: Rc<Semaphore>,
|
||||||
|
) -> Result<()> {
|
||||||
if !expect(&stream, b"ARTIQ management\n").await? {
|
if !expect(&stream, b"ARTIQ management\n").await? {
|
||||||
return Err(Error::UnexpectedPattern);
|
return Err(Error::UnexpectedPattern);
|
||||||
}
|
}
|
||||||
|
@ -200,6 +206,9 @@ async fn handle_connection(stream: &mut TcpStream, pull_id: Rc<RefCell<u32>>, cf
|
||||||
let value = cfg.write(&key, buffer);
|
let value = cfg.write(&key, buffer);
|
||||||
if value.is_ok() {
|
if value.is_ok() {
|
||||||
debug!("write success");
|
debug!("write success");
|
||||||
|
if key == "idle_kernel" {
|
||||||
|
restart_idle.signal();
|
||||||
|
}
|
||||||
write_i8(stream, Reply::Success as i8).await?;
|
write_i8(stream, Reply::Success as i8).await?;
|
||||||
} else {
|
} else {
|
||||||
// this is an error because we do not expect write to fail
|
// this is an error because we do not expect write to fail
|
||||||
|
@ -213,6 +222,9 @@ async fn handle_connection(stream: &mut TcpStream, pull_id: Rc<RefCell<u32>>, cf
|
||||||
let value = cfg.remove(&key);
|
let value = cfg.remove(&key);
|
||||||
if value.is_ok() {
|
if value.is_ok() {
|
||||||
debug!("erase success");
|
debug!("erase success");
|
||||||
|
if key == "idle_kernel" {
|
||||||
|
restart_idle.signal();
|
||||||
|
}
|
||||||
write_i8(stream, Reply::Success as i8).await?;
|
write_i8(stream, Reply::Success as i8).await?;
|
||||||
} else {
|
} else {
|
||||||
warn!("erase failed");
|
warn!("erase failed");
|
||||||
|
@ -229,17 +241,17 @@ async fn handle_connection(stream: &mut TcpStream, pull_id: Rc<RefCell<u32>>, cf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(cfg: Config) {
|
pub fn start(cfg: Rc<Config>, restart_idle: Rc<Semaphore>) {
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
let pull_id = Rc::new(RefCell::new(0u32));
|
let pull_id = Rc::new(RefCell::new(0u32));
|
||||||
let cfg = Rc::new(cfg);
|
|
||||||
loop {
|
loop {
|
||||||
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();
|
||||||
let cfg = cfg.clone();
|
let cfg = cfg.clone();
|
||||||
|
let restart_idle = restart_idle.clone();
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
info!("received connection");
|
info!("received connection");
|
||||||
let _ = handle_connection(&mut stream, pull_id, cfg)
|
let _ = handle_connection(&mut stream, pull_id, cfg, restart_idle)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| warn!("connection terminated: {:?}", e));
|
.map_err(|e| warn!("connection terminated: {:?}", e));
|
||||||
let _ = stream.flush().await;
|
let _ = stream.flush().await;
|
||||||
|
|
|
@ -102,7 +102,7 @@ mod remote_moninj {
|
||||||
overrd: i8,
|
overrd: i8,
|
||||||
value: i8,
|
value: i8,
|
||||||
) {
|
) {
|
||||||
let _lock = aux_mutex.lock();
|
let _lock = aux_mutex.async_lock().await;
|
||||||
drtioaux_async::send(
|
drtioaux_async::send(
|
||||||
linkno,
|
linkno,
|
||||||
&drtioaux_async::Packet::InjectionRequest {
|
&drtioaux_async::Packet::InjectionRequest {
|
||||||
|
|
Loading…
Reference in New Issue