You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Foundational work to allow async/await on multiple file descriptors
A slightly different version of this patch has been sitting on a local
branch for almost two years, so I decided to take a look this weekend
and ended up rewriting it this weekend so it's compatible with the
current version of Lwan's event loop.
While this won't allow a request handler to await on multiple file
descriptors just yet, it lays down the foundations to do so by making
all the necessary plumbing changes to allow a coro_yield() from a
request handler to receive a pointer to the struct lwan_connection that
caused the request handler to be awoken.
The actual changes are minimal (with little to no overhead), but some
comments had to be added throghout to explain certain things as the
ownership of certain values isn't clear from the struct definition
alone anymore.
No APIs have been implemented to allow waiting for multiple file
descriptors at once yet, but they will probably follow in the next few
weeks. I got to make sure it also works with the HTTP connection
coroutine as well as any other file descriptor a handler might decide
to use (e.g. a pubsub subscription); this would allow, for instance, a
chat application to wait on both the WebSocket connection and the
pubsub subscription and react as fast as it's able to. Let's see
what I end up coming up with.
Tested to compile only; have not tested if this feature works yet,
but normal requests seems to work fine.
0 commit comments