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

Feature/Modernize-the-code #2

Merged
merged 22 commits into from
Mar 21, 2025
Merged

Conversation

ClausKlein
Copy link
Owner

No description provided.

@ClausKlein ClausKlein force-pushed the feature/tests-without-queue branch from 02e4fb2 to ad0a22c Compare March 17, 2025 16:23
@@ -213,7 +215,7 @@ class client
if (!error)
{
// Extract the newline-delimited message from the buffer.
std::string const line(input_buffer_.substr(0, n - 1));
std::string const line = input_buffer_.substr(0, n - 1); // NOTE: w/o '\n'
Copy link
Owner Author

Choose a reason for hiding this comment

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

use initialiser list {}

// XXX [this](const boost::system::error_code& /*e*/, PH1) {
// handle_write(std::forward<decltype(PH1)>(PH1)); });
boost::asio::async_write(socket_, boost::asio::buffer(message),
[this, self](const boost::system::error_code& error, std::size_t) { handle_write(error); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!

// handle_read(std::forward<decltype(PH1)>(PH1),
// std::forward<decltype(PH2)>(PH2)); });
boost::asio::async_read_until(socket_, boost::asio::dynamic_buffer(input_buffer_), '\n',
[this, self](const boost::system::error_code& error, std::size_t n) { handle_read(error, n); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!

// Put the actor back to sleep.
// cpp11: deadline_.async_wait(std::bind(&client::check_deadline, this));
deadline_.async_wait([this](const boost::system::error_code& /*e*/) { check_deadline(); });
deadline_.async_wait([this, self](const boost::system::error_code& /*e*/) { check_deadline(); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!


// Start an asynchronous operation to send the message.
boost::asio::async_write(socket_, boost::asio::buffer(message),
[this, self](const boost::system::error_code& error, std::size_t) { handle_write(error); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!

@@ -137,18 +149,18 @@ class AsynchronousTCPClient : public std::enable_shared_from_this< AsynchronousT
});
}

boost::asio::async_read_until(socket_, boost::asio::dynamic_buffer(data_), CR,
boost::asio::async_read_until(socket_, boost::asio::dynamic_buffer(data_), STOP,
[this, self](boost::system::error_code ec, std::size_t length)
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!

auto self(shared_from_this());

// Put the actor back to sleep.
deadline_.async_wait([this, self](const boost::system::error_code& /*e*/) { check_deadline(); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!


// Start an asynchronous operation to read a newline-delimited message.
boost::asio::async_read_until(socket_, boost::asio::dynamic_buffer(input_buffer_), '\n',
[this, self](const boost::system::error_code& error, std::size_t n) { handle_read(error, n); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!


// Start an asynchronous operation to send a heartbeat message.
boost::asio::async_write(socket_, boost::asio::buffer(message),
[this, self](const boost::system::error_code& error, std::size_t) { handle_write(error); });
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!

{
auto self(shared_from_this());
boost::asio::async_write(socket_, boost::asio::buffer(write_msgs_.front()),
[this, self](boost::system::error_code ec, std::size_t /*length*/)
Copy link
Owner Author

Choose a reason for hiding this comment

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

prevent use of this!

@ClausKlein ClausKlein self-assigned this Mar 20, 2025
@ClausKlein ClausKlein merged commit a34e2d3 into develop Mar 21, 2025
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.

1 participant