mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
cleanup the poll timeouts
This commit is contained in:
parent
5e411f3562
commit
e78b40aa36
1 changed files with 9 additions and 3 deletions
|
|
@ -52,6 +52,11 @@ pub static MAC_ADDRESS_MSB: AtomicU16 = AtomicU16::new(0);
|
||||||
|
|
||||||
const PING_DEFAULT_TIMEOUT_MS: u32 = 10_000;
|
const PING_DEFAULT_TIMEOUT_MS: u32 = 10_000;
|
||||||
const PING_IDENT: u16 = 0x22b;
|
const PING_IDENT: u16 = 0x22b;
|
||||||
|
/// This sets the default poll time on the net interface.
|
||||||
|
/// Anything smaller than 1 ms is rounded up to 1ms; increasing this
|
||||||
|
/// number saves power. In general, most network events create an interrupt
|
||||||
|
/// so the poll interval should be OK to be set quite high.
|
||||||
|
const NET_DEFAULT_POLL_MS: u64 = 500;
|
||||||
|
|
||||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||||
enum WaitOp {
|
enum WaitOp {
|
||||||
|
|
@ -140,7 +145,7 @@ fn set_com_ints(com_int_list: &mut Vec<ComIntSources>) {
|
||||||
|
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
log_server::init_wait().unwrap();
|
log_server::init_wait().unwrap();
|
||||||
log::set_max_level(log::LevelFilter::Info);
|
log::set_max_level(log::LevelFilter::Debug);
|
||||||
log::info!("my PID is {}", xous::process::id());
|
log::info!("my PID is {}", xous::process::id());
|
||||||
|
|
||||||
let xns = xous_names::XousNames::new().unwrap();
|
let xns = xous_names::XousNames::new().unwrap();
|
||||||
|
|
@ -361,7 +366,7 @@ fn main() -> ! {
|
||||||
let timestamp = Instant::now();
|
let timestamp = Instant::now();
|
||||||
let deadline = match iface.poll_at(timestamp, &sockets) {
|
let deadline = match iface.poll_at(timestamp, &sockets) {
|
||||||
Some(poll_at) if timestamp < poll_at => poll_at - timestamp,
|
Some(poll_at) if timestamp < poll_at => poll_at - timestamp,
|
||||||
_ => Duration::from_millis(0),
|
_ => Duration::from_millis(NET_DEFAULT_POLL_MS),
|
||||||
};
|
};
|
||||||
|
|
||||||
let msg_or_timeout = core_rx.recv_timeout(
|
let msg_or_timeout = core_rx.recv_timeout(
|
||||||
|
|
@ -1304,7 +1309,8 @@ fn main() -> ! {
|
||||||
let now = timer.elapsed_ms();
|
let now = timer.elapsed_ms();
|
||||||
let timestamp = Instant::from_millis(now as i64);
|
let timestamp = Instant::from_millis(now as i64);
|
||||||
if !iface.poll(timestamp, &mut device, &mut sockets) {
|
if !iface.poll(timestamp, &mut device, &mut sockets) {
|
||||||
log::debug!("poll error");
|
// nothing to do, continue on.
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect calls take time to establish. This block checks to see if connections
|
// Connect calls take time to establish. This block checks to see if connections
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue