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

http: propagate tcp timeout errors #30

Merged

Conversation

oviano
Copy link
Contributor

@oviano oviano commented Aug 26, 2024

This PR defines two error codes for tcp_send/recv according to whether the error was a timeout or another error. This is used to fill in a new timed_out flag in the http response structure. Finally this is checked by the upnp protocol code to return PROTOCOL_ERR_TIMEOUT if necessary.

This means that if a protocol fails to complete successfully due to a TCP timeout it will be retried under the same system that is used for timing out waiting for broadcast responses.

@oviano oviano mentioned this pull request Aug 26, 2024
@oviano oviano force-pushed the propagate_tcp_timeouts branch from 82e85f4 to a4a31ca Compare August 28, 2024 16:06
src/http.h Outdated
@@ -33,6 +34,7 @@ typedef struct http_response {
char *headers;
char *body;
size_t body_size;
bool timed_out;
Copy link
Owner

Choose a reason for hiding this comment

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

I don't really like adding a boolean in the response, I think time out should be an error just like you did for TCP.

@oviano
Copy link
Contributor Author

oviano commented Sep 2, 2024

That's fair enough, I'm not sure why I did it like that, come to think of it!

Will fix it up in a bit.

@oviano oviano force-pushed the propagate_tcp_timeouts branch 3 times, most recently from e7f7a3c to 36b7aa0 Compare September 2, 2024 13:13
@oviano oviano force-pushed the propagate_tcp_timeouts branch from f843a28 to ad29767 Compare September 2, 2024 13:20
Copy link
Owner

@paullouisageneau paullouisageneau left a comment

Choose a reason for hiding this comment

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

It looks good, thank you for the fix!

@paullouisageneau paullouisageneau changed the title http: propagate tcp timeout errors via timed_out flag http: propagate tcp timeout errors Sep 3, 2024
@paullouisageneau paullouisageneau merged commit 17836a5 into paullouisageneau:master Sep 3, 2024
3 checks passed
@oviano oviano deleted the propagate_tcp_timeouts branch September 3, 2024 10:56
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.

2 participants