Commit Graph

23 Commits

Author SHA1 Message Date
Jeff Epler 774f6ac6ab
Switch to using MP_ERROR_TEXT instead of translate, globally 2023-10-30 09:49:06 +01:00
Scott Shawcroft 544553c542
Fix cyw43 (pico w) builds 2023-10-16 10:43:30 -07:00
Dan Halbert 2ff8667e75 wip; remove long-lived functionality; remove PR#2614
Trinket M0 compile has no compilation errors, but has link errors to fix.
2023-08-08 20:41:17 -04:00
Ted Hess 9825b7fbb7 Web Workflow sockets and threads handling improvements.
Fixes polling thread looping forever hangs preventing new connections.
Don't lose listening sockets on mp resets and re-init.
Keep better separation of "system" and "user" sockets.
Track socket states to prevent re-use of sockets before closed.
Close REST socket when transaction completes. No post-init.
Remove unnecessary state flags.
2023-04-05 13:50:42 -04:00
Gregory Neverov 173bc198c6 don't set tcp_err callback for listen sockets 2023-03-29 11:49:32 -07:00
Jeff Epler e05f0ba3b2
Revert "Correctly raise OS error in socketpool_socket_recv_into()"
This reverts commit 7e6e824d56.

Fixes #7770

The change in #7623 needs to be revered; the raise-site added in #7632
is the correct one and the one in socketpool needs to be reverted.

This is not affecting 8.0.x because #7623 was not back-ported to there
before we realized it was not a full fix.

Both #7770 and #7606 should be re-tested. I didn't test.
2023-03-22 14:32:06 -05:00
root 7e6e824d56 Correctly raise OS error in socketpool_socket_recv_into() 2023-02-21 13:38:29 -06:00
Jeff Epler 928fb0a9c4
Make the "name or service not known" message translatable 2022-12-26 13:58:31 -06:00
Jeff Epler 297657ea9a
Refactor so that all sites of name lookup failure result in gaierror 2022-12-14 14:45:32 -06:00
Scott Shawcroft c3a96a63c0
Enable* web workflow for Pico W
* Except for circuitpython.local which depends on MDNS and will be
done in a follow up PR.

Progress on #7214
2022-11-21 16:24:05 -08:00
Jeff Epler 452ebe27ae
socketpool: make socket objects selectable
.. which will lead to them being usable in async contexts, pending
relevant changes in asyncio
2022-11-05 12:05:19 -05:00
Jeff Epler f997d0053d
Enable, use SOF_REUSEADDR
This is the lwip no-os version of SO_REUSEADDR, which is set on all
listening sockets in the espressif port; do so here as well,
it makes running servers easier. The "address in use" error does
not occur.
2022-10-25 10:09:16 -05:00
Jeff Epler 57756863ef
picow: depending on memory pressure, may only be able to write 1 MSS
Foamyguy discovered that trying to send >2920 bytes at once consistently
failed. I further discovered that sometimes trying to send >1460 bytes
would fail too.  By "fail", I mean that it would take a very long time
(around 200 * 50ms) before erroneously reporting that all bytes were
written.

In my testing, this change causes larger writes to successfully
send either 2920 or 1460 bytes (possibly after doing some 50ms waits
for a previous packet to clear).

The documentation of socket.send always stated that it COULD send fewer
bytes than requested, but adafruit_httpserver assumed that the number
of requested bytes were always sent, so after this change alone,
adafruit_httpserver will still not work properly.

Closes: #7077 (albeit fixes are needed in adafruit_httpserver too)
2022-10-17 19:42:07 -05:00
Jeff Epler 861b22730e
picow: if initial write fails, write at most 1 TCP MSS of data 2022-10-17 19:28:02 -05:00
Georg Bøe e768b9ebb3 Return correct errno 2022-10-13 21:00:51 +02:00
Jeff Epler ca9523b814
Pico w: socket: Correctly return negative error code from recv_into 2022-10-12 11:38:29 -05:00
Jeff Epler 62cbd3bcd8
Pico w: socket: correctly track sockets generated by accept() 2022-10-12 11:38:26 -05:00
Jeff Epler afc1c0e3bb
Fix unused variable diagnostics, make it a fatal error 2022-09-30 11:19:22 -05:00
Jeff Epler 37620d4eb0
Fix several classes of compiler diagnostic & make fatal
* -Wno-nested-externs
 * -Wno-strict-prototypes
 * -Wno-double-promotion
 * -Wno-sign-compare
2022-09-30 11:19:22 -05:00
Jeff Epler 74cdf42ece
pico w: implement bind, listen, accept
this works with some simple tcp & udp echo service code
2022-09-29 10:02:20 -05:00
Jeff Epler 09d4fbc557
Remove FIXME
this was verbatim-copied from micropython
2022-09-28 14:38:13 -05:00
Jeff Epler ff7731491e
Implement enough of socketpool to do ntp and non-https requests 2022-09-28 10:06:34 -05:00
Jeff Epler a7a1bd7880
Implement DNS resolution
```
>>> s = socketpool.SocketPool(wifi.radio)
>>> s.getaddrinfo("google.com", 80)
[(0, 0, 0, '', ('142.250.81.206', 80))]
```
2022-09-28 10:06:33 -05:00