Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the network stack API multiwaiter-compatible #44

Open
hlef opened this issue Oct 18, 2024 · 1 comment
Open

Make the network stack API multiwaiter-compatible #44

hlef opened this issue Oct 18, 2024 · 1 comment

Comments

@hlef
Copy link
Collaborator

hlef commented Oct 18, 2024

The multiwait API allows a waiter to wait on multiple events.

It would be very useful if we could make the network API compatible with this API so that a thread can wait on several socket receives, accepts, etc. Callers currently need to create multiple threads to do this. This would be the equivalent of poll or select.

To make the network stack API multiwaiter-compatible, we need to expose a futex.

A few locations where adding this futex would make sense (to be edited when new ideas come):

  • receive bytes: network_socket_receive, network_socket_receive_preallocated, network_socket_receive_from, and the TLS equivalents tls_connection_receive_preallocated, tls_connection_receive
  • send bytes: network_socket_send, network_socket_send_to, and the TLS equivalent tls_connection_send
  • connect to a remote host: network_socket_connect_tcp
  • accept a connection: network_socket_accept_tcp in the new server API (Add a server API. #39)
@hlef hlef mentioned this issue Oct 18, 2024
@hlef
Copy link
Collaborator Author

hlef commented Oct 18, 2024

Note on how to implement this for the network_socket_accept_tcp case: we likely want to keep a futex that counts how many connections are ready to be accepted. We can maintain that through the on_tcp_connect callback (linked into FreeRTOS+TCP through FREERTOS_SO_TCP_CONN_HANDLER).

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

No branches or pull requests

1 participant