Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Can the async stuff be feasibly upstreamed? #80

Closed
svenstaro opened this issue Apr 24, 2022 · 7 comments
Closed

Can the async stuff be feasibly upstreamed? #80

svenstaro opened this issue Apr 24, 2022 · 7 comments

Comments

@svenstaro
Copy link
Contributor

Currently you maintain a bunch of downstream forks (which is great!) but I think it'd be even better if async with esp32 could just work out of the box with upstream libraries. Do you think there's a chance to get your work integrated upstream?

@ivmarkov
Copy link
Owner

Yes, there is. But I think it is a bit too early. For one, I've yet to see something meaningful implemented either by the community, or by me which is using these patches. For example, a pure rust async mqtt client. Or http client. Or http server. Once some of these things start popping up, I'll upstream.

@ivmarkov
Copy link
Owner

ivmarkov commented Apr 25, 2022

By the way - and if it is not clear - the "async" patches revolve around asynchronous networking. They basically (a) patch the socket2 crate to be ESP-IDF compatible, and (b) the polling crate (the smol "reactor") to be - ditto - ESP-IDF compatible. Hence my comment that until somebody starts using async networking from Rust (as in async TCP sockets), I don't feel comfortable upstreaming those.

If you don't explicitly require/use async networking (as in instead just using the available HTTP client and MQTT client from esp-idf-svc - note that the latter can be "asyncified" - haven't checked the former yet) - you actually don't even need these patches.

For example, async-task (the async executor used by smol and async-std) as well as the executor of futures-rs work just fine, unpatched. I've even implemented and I'm using an async executor (on top of async-task) that can be notified directly from an ISR context. E.g. a button click or a timer firing. But that's another story.

@ivmarkov
Copy link
Owner

ivmarkov commented Aug 5, 2022

With edge-net on the horizon, I've started upstreaming the async stuff.

First patch that needs to happen is in libc itself: rust-lang/libc#2864

The patches to polling, socket2 and smol itself will follow after that.

@SimonSapin
Copy link

Hence my comment that until somebody starts using async networking from Rust (as in async TCP sockets), I don't feel comfortable upstreaming those.

Hi! I recently got a couple ESP32-C3 boards. The project I have in mind would involve an HTTPS client (to send sensor data to a server, and i2c and BTLE to collect said data). I was thinking of using esp-idf for the wifi driver and the TCP implementation, but use Rust async + Hyper + rustls for HTTPS. I’m happy to try out patches.

@jasta
Copy link

jasta commented Jul 14, 2023

I'm also attempting upstreaming similar changes but for tokio support: tokio-rs/tokio#5867. The socket2 changes are the same, though.

@ivmarkov
Copy link
Owner

Both tokio and smol changes are now upstreamed. Moreover, the changes to the async-io echosystem are also released as async-io 2.

Closed.

@svenstaro
Copy link
Contributor Author

That's great news!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants