mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
add some delay on hosted mode for failed name requests
helps make startup a bit more orderly on multi-core systems
This commit is contained in:
parent
04f1d11c69
commit
b36865a893
1 changed files with 15 additions and 4 deletions
|
|
@ -38,6 +38,12 @@ mod implementation {
|
||||||
xous::yield_slice();
|
xous::yield_slice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn hosted_delay(&self) {
|
||||||
|
// this is a delay used in hosted mode to prevent threads from thrashing. We don't need this on
|
||||||
|
// raw hardware because we aren't multi-core, and thus a yield_slice() will always schedule
|
||||||
|
// a different process to run, whereas a yield_slice() on hosted/emulation can immediately return
|
||||||
|
// and cause troubles for other processes.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,6 +57,9 @@ mod implementation {
|
||||||
pub fn deterministic_busy_wait(&self) {
|
pub fn deterministic_busy_wait(&self) {
|
||||||
// don't do anything for hosted mode
|
// don't do anything for hosted mode
|
||||||
}
|
}
|
||||||
|
pub fn hosted_delay(&self) {
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,26 +188,27 @@ fn xmain() -> ! {
|
||||||
response = api::Return::CID(connection_id)
|
response = api::Return::CID(connection_id)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
info!(
|
log::debug!(
|
||||||
"Can't find request '{}' in table, dumping table:",
|
"Can't find request '{}' in table, dumping table:",
|
||||||
name
|
name
|
||||||
);
|
);
|
||||||
for kv_tuple in name_table.map.iter() {
|
for kv_tuple in name_table.map.iter() {
|
||||||
if let Some((key, val)) = kv_tuple {
|
if let Some((key, val)) = kv_tuple {
|
||||||
info!("name: '{}', sid: '{:?}'", key, val);
|
log::debug!("name: '{}', sid: '{:?}'", key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
d11ctimeout.hosted_delay();
|
||||||
response = api::Return::Failure
|
response = api::Return::Failure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info!(
|
log::debug!(
|
||||||
"Can't find request '{}' in table, dumping table:",
|
"Can't find request '{}' in table, dumping table:",
|
||||||
name
|
name
|
||||||
);
|
);
|
||||||
for kv_tuple in name_table.map.iter() {
|
for kv_tuple in name_table.map.iter() {
|
||||||
if let Some((key, val)) = kv_tuple {
|
if let Some((key, val)) = kv_tuple {
|
||||||
info!("name: '{}', sid: '{:?}'", key, val);
|
log::debug!("name: '{}', sid: '{:?}'", key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no authenticate remedy currently supported, but we'd put that code somewhere around here eventually.
|
// no authenticate remedy currently supported, but we'd put that code somewhere around here eventually.
|
||||||
|
|
@ -208,6 +218,7 @@ fn xmain() -> ! {
|
||||||
pubkey_id: [0; 20], // placeholder
|
pubkey_id: [0; 20], // placeholder
|
||||||
challenge: [c1, c2, c3, c4],
|
challenge: [c1, c2, c3, c4],
|
||||||
};
|
};
|
||||||
|
d11ctimeout.hosted_delay();
|
||||||
response = api::Return::AuthenticateRequest(auth_request) // this code just exists to exercise the return path
|
response = api::Return::AuthenticateRequest(auth_request) // this code just exists to exercise the return path
|
||||||
}
|
}
|
||||||
buffer.replace(response).expect("Lookup can't serialize return value");
|
buffer.replace(response).expect("Lookup can't serialize return value");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue