smoltcp requires some polling to be done in the future for it
to work with low latency. It returns a time in the future for
the next poll.
This refactors the polling algorithm to:
1. use a fixed thread pool. This burns a little extra memory in
exchange for not having to allocate/de-allocate threads every
time a follow-up is needed.
2. use a short/long scheduler, where short delays (shorter than
the scheduler quantum) are grouped together, and only a single
follow-up is fired off within that time range if needed. Longer
delays have a larger window (roughly +/- 100ms) of grouping,
so fewer such events are also required in the distant future.
Empirically the delays seem to fall into two groups, either "short"
(less than 20ms) or "long" (around 700ms).
This improved scheduler uses fewer threads and generates less
messages, so instead of 16 threads and encountering exhaustion
we have 9 and have yet to see more than 7 used even under the
most strenuous tests (multiple while-true curl loops + fountain
test + ping simultaneously).
Some helpful debug is also printed now when scheduler runs out
of slots, so we can see the distribution of pending delays.
we no longer create a new interface on net reset, which means that
the socket handles don't blow up if we change IP addresses.
However, the ARP cache is still stale and there seems to be on way
to force it to flush....but I guess in theory, eventually it
should fix itself, if smoltcp is working correctly?
the refactor changes the way sockets are handled, so now, when
the interface is rebound we are certain to get panics.
working on resolving this detail now, but at least the interface
is working now and it seems more stable than before.
I don't know why it doesn't break under a default config, but if
xous-core is cloned to a directory that doesn't match the repo
name this breaks. This patch tries to fix it for that case.
Messages should be able to be forwarded from one Server to another. This
is a wrapper around the machinery that would do that.
Signed-off-by: Sean Cross <sean@xobs.io>
Allow setting a message's ID by adding a `set_id(&mut self, ...)`
function. This can be used when regifting a message.
Signed-off-by: Sean Cross <sean@xobs.io>
Use a `Vec<u8>` as a backing for memory across the entire project.
Previously we used `Vec<u8>` as a backing for MemoryMessages and used
`alloc` for all other messages. This unifies that to always use
`Vec<u8>`.
I'd prefer if we used `alloc` instead, however that has not been working
and I'm not sure why. Standardize on this for now and look into why
later.
Signed-off-by: Sean Cross <sean@xobs.io>
The `Messages` types were getting hairy, and `definitions.rs` was really
long. Trim it down by moving types into their own files.
Signed-off-by: Sean Cross <sean@xobs.io>
change the notification modal to accept the primary message and an
Option of independent text to display as a qrcode
pub fn show_notification(&self, notification: &str, qrtext:Option<&str>) -> Result<(), xous::Error> {}