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

Implement edge_nal::TcpAccept trait from edge-net #38

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

AnthonyGrondin
Copy link
Contributor

This PR provides an implementation of edge_nal::TcpAccept to use esp-mbedtls with edge-net.

As for now, the trait is simply a wrapper over the edge_nal::TcpAccept implementation from edge-nal-embassy.

I also provided an example that uses edge-http in server mode for testing, and ensuring compatibility.

Further down the line, other traits will also get their implementation, in subsequent PRs, as I (or any contributor) come around a use case for them.

@AnthonyGrondin
Copy link
Contributor Author

I'll write this here to document the behavior, but there is currently an issue with how esp-wifi, esp-mbedtls, edge-net act together.

Specifically, if a client sends a request with the header "Connection": "Close", the server implementation of edge-net requests a read() from esp-mbedtls (It won't if the body type is something else). Since the client has sent all its data, async_internal_read() will hang on reading data from socket. This is due to esp-wifi's read impl that blocks on read until there is data.

@ivmarkov
Copy link

I'll write this here to document the behavior, but there is currently an issue with how esp-wifi, esp-mbedtls, edge-net act together.

Specifically, if a client sends a request with the header "Connection": "Close", the server implementation of edge-net requests a read() from esp-mbedtls (It won't if the body type is something else). Since the client has sent all its data, async_internal_read() will hang on reading data from socket. This is due to esp-wifi's read impl that blocks on read until there is data.

I'm not sure I follow 100% but regardless, are you using the master version of edge-http?
There is a fix in master I did recently which avoids a similar (yet, the opposite) problem, where if there are multiple requests scheduled over a single TCP connection, the processing of the first request might read a bit into the second request.

Copy link
Collaborator

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@bjoernQ bjoernQ merged commit 41a1b56 into esp-rs:main Jul 19, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants