martinzink commented on code in PR #1595:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1595#discussion_r1250977536
##########
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:
I think this should be a continue instead of co_return similar to how errors
were handled before the coro rewrite (if we encounter an error we dont open a
socket but carry on).
We have this problem in TCPServer aswell. I've fixed that one in
https://github.com/apache/nifi-minifi-cpp/pull/1592/files#diff-924bd95b72a2543c8a20ebd77132a2f64d563f851a318cd515091ee2fdf927b1R33-R34
--
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]