Commit graph

105 commits

Author SHA1 Message Date
bunnie
969b4ec868 refactor net firewall to use .forward() method 2022-04-25 18:30:24 +08:00
bunnie
8d28f130ea fix a missing case for hardware not caught by hosted mode 2022-04-24 21:53:18 +08:00
bunnie
f4f0812fb4 refactor API to use the None encoding for 0 on NonZeroUsize MemoryMessage fields
at the suggestion of @xobs, requires a new libstd to work with this.
2022-04-19 01:32:36 +08:00
bunnie
89ceba9674 tweak some parameters and debug infos
total threads in the net crate are around 10 right now, 32 max, so
increasing the sleeping thread limit to 16, since every now and then
we get exhaustion notes.
2022-04-17 18:49:27 +08:00
bunnie
ecd875e64f remove the legacy files 2022-04-17 05:00:51 +08:00
bunnie
12190b9184 strip out the legacy xous Tcp stack implementation 2022-04-17 04:59:10 +08:00
bunnie
a97b548f94 implement Shutdown for TcpStream 2022-04-17 04:07:54 +08:00
bunnie
806b09ec0d apply TcpStream fixes
- allow for zero-length tx/rx returns
- implement "shutdown" function, which is different from close:
shutdown requires any pending connections to return Ok(0) immediately,
but the socket is not dropped.
2022-04-17 04:06:05 +08:00
bunnie
9eb35ddd49 Merge remote-tracking branch 'origin/main' into bunnie-dev 2022-04-16 06:28:29 +08:00
bunnie
a555f0380e initial tcplistener draft 2022-04-16 06:26:08 +08:00
bunnie
cd8c762c55 patch up QR code PR, change method signature as discussed
now any modal notification can also render as a QR code
2022-04-08 15:19:56 +08:00
bunnie
12ced30f40 fix a minor typo 2022-04-07 17:37:20 +08:00
bunnie
92c6a93147 eliminate yield loop on blocking mount poller 2022-04-07 00:04:25 +08:00
bunnie
b7adbcff52 remove no longer used UDP API stubs 2022-04-05 18:43:16 +08:00
bunnie
dacc38808e fix blocking message detection clause in two places 2022-04-05 13:31:50 +08:00
bunnie
532c4a4f1f add NTP to time setting via SNTP library 2022-04-05 04:19:53 +08:00
bunnie
cbb1e3f944 fix various bugs related to UDP; prep for transition to libstd-only UDP 2022-04-05 00:39:56 +08:00
bunnie
067c603e03 strip out old UDP libraries, harmonize on just libstd UDP 2022-04-04 23:15:51 +08:00
bunnie
57339dfe2f udp libstd passing inital tests 2022-04-04 22:37:01 +08:00
bunnie
b5a6c436c2 first draft at some basic libstd UDP mechanics 2022-04-04 04:49:17 +08:00
bunnie
9dc75071ad split up the main.rs file
it's going to get unwieldy if we stick all of std::net into just main.rs
2022-04-02 17:57:50 +08:00
bunnie
d61622bcde add a 1-second delay on resume before telling connection manager to reconnect
now that the suspender is in its own thread, we can do this safely.
It's nice to have a bit of a delay because we want other system recovery
things to take precedence and settle out before we try pinging the COM
to see how the wifi changed while we were asleep.
2022-03-30 02:34:22 +08:00
bunnie
6a6c2aef0f add a thread to respond to suspend requests on the connection manager
the connection manager actually wants a ping on resume,
and when we suspend we suspend -- "it is what it is". However,
the connection manager is a hairball that can block for a while,
so, to prevent failures to suspend, we put the suspend listener
in its own thread, and on resume the suspend listener will
automagically kick out an event to tell the connection manager
to deal with stuff.
2022-03-30 02:29:09 +08:00
bunnie
b4c98528e8 add notes around names that are baked into libstd 2022-03-22 22:30:43 +08:00
bunnie
fe52756a3d convert the connection manager to use the new PDDB blocking call 2022-03-22 22:17:04 +08:00
Sean Cross
d6063d9992 net: don't close connection when setting fields
Due to overly liberal use of `.take()`, file handles were getting closed
when doing ordinary operations. This stops that.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 20:47:10 +08:00
Sean Cross
0b3fc8e98e net: add functions for setting ttl, nodelay
Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 18:43:39 +08:00
Sean Cross
08b9f0bcfc services: net: add StdTcpPeek call
This is used to peek on a stream

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 15:24:01 +08:00
Sean Cross
9217c2227f services: net: add timeout to connect api
This now adds a `timeout` parameter to the connect() API call.
Additionally, connections will not be returned until they are determined
to be open, or until an error occurs (such as a timeout).

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 12:08:28 +08:00
Sean Cross
89442ff4cc net: add StdTcp calls
These calls have been tested to work to create tcp connections.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-17 20:38:21 +08:00
bunnie
21ad8d9283 change en-audio to en-tts 2022-03-10 15:38:55 +08:00
bunnie
526bc959af add some facilities for testing net in libstd 2022-03-02 20:43:01 +08:00
bunnie
760957154e add a crappy but slightly more accurate approximation of UDP to hosted mode
It's crappy because it uses a busy wait loop to poll the udp
rx socket in order to accurately emulate the Xous async callback
feature (which is _not_ emulated for Tcp, for example).

It's more accurate because this emulation happens. But it's a lot
more complicated to implement it because zero-cost async UDP callbacks
aren't really a host-native feature (but they are a Xous-native feature!),
and I didn't want to .. pull in tokio or mio code surface into
the Xous hosted mode, seemed a bit like crushing a fly by dropping
a house on it. Maybe that's a fine solution in Oz, but Xous doesn't live in Oz.
2022-02-21 00:54:46 +08:00
bunnie
0dbf1661cb add TCP to hosted mode emulation
Total bodge -- we lop off the TCP stack at the Xous API level, and
substitute it with a native host TCP stack.

Caveat hacker: this means that a lot of OS-specific net properties
will carry through to the hosted mode emulation. This is adequate
for "smoke testing" a build but do not be shocked, *shocked* if
there are more bugs to be found because of some weird host integration
issue.
2022-02-20 21:31:32 +08:00
bunnie
e01abb29e9 update min version requirement for EC compatibility 2022-02-04 01:44:34 +08:00
bunnie
955d0182d6 some very minor ergonomic improvements around network connection UX 2022-02-03 18:38:43 +08:00
bunnie
b7c0387186 connection manager: interpret DHCP state before concluding we're connected 2022-02-03 13:37:14 +08:00
bunnie
8f321d540e clean up a spurious dialog box in hosted mode 2022-02-02 23:59:37 +08:00
bunnie
562a930ce0 add APIs to pause the connection manager, and pause the CM while doing EC updates
It's not a good time to bug the EC to do network stuff when it's updating
itself.

...might even want to send the network into a disconnected state,
but, let's start with just turning off the connection manager
for now.
2022-02-02 02:38:19 +08:00
bunnie
13de52fa8d TcpListener debugging, just a little bit
Spent a couple hours chasing down a "bug" which is acutally just
something about how http works that I don't understand. TCP was
working just fine but there is ... idk some sort of keep alive
thing that occupies a socket so the "web server" blocks waiting
for a read. Anyways, I guess the "right" way to solve that would
be to make a multi-threaded web server

OH GOD STOP

right. it's just a demo to prove that TCP works. done.

Open an issue if you find a problem with TCP kthx!
2022-02-02 00:23:14 +08:00
bunnie
925d53f646 TCP listener is "working"
Good enough so that if you type `net server` and you hit the IP
address of the device, it'll respond with something like

Hello from Precursor!
I have been up for 86087 ms.

There's still all kinds of bugs, I'm sure. But ... I'm also not
sure /why/ you would want a web server on Precursor. This is more
just to make sure that the TCP stack isn't totally broken.

The "web server" as it may be is quite broken and doesn't parse
any headers and probably sends a bogus amount of data because
I can't figure out if the content length includes some new lines
or not. But really, this just isn't in scope. Works with Chrome,
Firefox shows the status page and then says "connection reset" and hides
all the information. Whatever, browser compatibility is well beyond
my pay grade!
2022-02-01 18:54:07 +08:00
bunnie
5c91645ede Merge branch 'i18n-jp' into bunnie-dev 2022-02-01 01:04:43 +08:00
bunnie
0910f7e373 tcpstream passing a simple demo test
not sure what other tests to run, not an expert in this stuff.
2022-01-31 14:35:55 +08:00
bunnie
4690075c40 clean build, but...much testing to do. 2022-01-31 04:03:31 +08:00
Jeanie
d1c443f62e
Merge branch 'i18n-jp' into i18n-jp 2022-01-30 19:25:33 +09:00
Jeanie
58e8120526 ja translations added 2022-01-30 19:23:49 +09:00
bunnie
177ad38db2 derive SSID scan on shellchat from the connection manager
The connection manager keeps track of all our SSIDs, not the COM.
2022-01-30 16:53:15 +08:00
bunnie
9b1c5e3f0c checkpoint to try something else 2022-01-30 15:30:21 +08:00
bunnie
2b7e428340 checkpoint, need to fix something else 2022-01-29 16:09:59 +08:00
bunnie
8592224af2 checkpoint partial TCP progress
server-side impl done, inter-crate API half-complete, now working on lib
2022-01-29 00:57:36 +08:00