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

Timeouts in operations with sockets #417

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aritosteles
Copy link
Contributor

Related issue
157

Description

This PR adds timeouts to socket operations that can block the process/co_routine indefinitely.

  • Compilation without warnings in every supported platform
    • Linux

@aritosteles aritosteles linked an issue Dec 12, 2024 that may be closed by this pull request
4 tasks
@aritosteles aritosteles self-assigned this Dec 12, 2024
@aritosteles aritosteles force-pushed the enhancement/157-improve-error-handling branch 4 times, most recently from 30f920d to 83e4230 Compare December 12, 2024 22:02
@@ -18,8 +21,10 @@ namespace http_client
/// @brief Connects the socket to the given endpoints
/// @param endpoints The endpoints to connect to
/// @param ec The error code, if any occurred
virtual void Connect(const boost::asio::ip::tcp::resolver::results_type& endpoints,
boost::system::error_code& ec) = 0;
virtual void Connect(boost::asio::io_context& io_context,
Copy link
Member

Choose a reason for hiding this comment

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

Add missing parameters to function description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

/// @param endpoints The endpoints to connect to
/// @param ec The error code, if any occurred
void Connect(const boost::asio::ip::tcp::resolver::results_type& endpoints,
boost::system::error_code& ec) override
void Connect(boost::asio::io_context& io_context,
Copy link
Member

Choose a reason for hiding this comment

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

Same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -27,24 +27,54 @@ namespace http_client
/// @brief Connects the socket to the given endpoints
/// @param endpoints The endpoints to connect to
/// @param ec The error code, if any occurred
void Connect(const boost::asio::ip::tcp::resolver::results_type& endpoints,
boost::system::error_code& ec) override
void Connect(boost::asio::io_context& io_context,
Copy link
Member

Choose a reason for hiding this comment

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

Same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Adds timeout to Connect() function
@aritosteles aritosteles force-pushed the enhancement/157-improve-error-handling branch 3 times, most recently from bfdaee3 to c6db8be Compare December 13, 2024 21:11
@aritosteles aritosteles force-pushed the enhancement/157-improve-error-handling branch from c6db8be to a6ba4f4 Compare December 13, 2024 21:14
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.

Improve error handling in network functions
2 participants