lordgamez commented on code in PR #1595:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1595#discussion_r1251010460
##########
libminifi/src/c2/ControllerSocketProtocol.cpp:
##########
@@ -86,32 +87,37 @@ void ControllerSocketProtocol::stopListener() {
io_context_.restart();
}
-void ControllerSocketProtocol::startAccept() {
- acceptor_->async_accept([this](const asio::error_code& error,
asio::ip::tcp::socket socket) {
- if (!error) {
- io::AsioStream<asio::ip::tcp::socket> stream(std::move(socket));
- handleCommand(stream);
+asio::awaitable<void> ControllerSocketProtocol::startAccept() {
+ while (true) {
+ auto [accept_error, socket] = co_await
acceptor_->async_accept(utils::net::use_nothrow_awaitable);
+ if (accept_error) {
+ logger_->log_error("Controller socket accept failed with the following
message: '%s'", accept_error.message());
+ co_return;
Review Comment:
Good point, updated in 3c4c32b943e927e77d2c4f9d49a52d5405b47f75
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]