fgerlits commented on code in PR #1600:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1600#discussion_r1290219001
##########
libminifi/src/utils/net/TcpServer.cpp:
##########
@@ -33,28 +33,37 @@ asio::awaitable<void> TcpServer::doReceive() {
co_await utils::net::async_wait(1s);
continue;
}
+ std::error_code error;
+ auto remote_address =
socket.lowest_layer().remote_endpoint(error).address();
+ if (error)
+ logger_->log_debug("Error during fetching remote endpoint: %s",
error.message());
+ auto local_port = socket.lowest_layer().local_endpoint(error).port();
+ if (error)
+ logger_->log_debug("Error during fetching local endpoint: %s",
error.message());
Review Comment:
Is it enough to log a debug message in these cases? Will `remote_address`
and `local_port` be usable after an error?
Also: is it safe to reuse `error`? Will it be reset to 0 if there was an
error on line 37, but no error in line 42?
##########
extensions/standard-processors/tests/unit/PutTCPTests.cpp:
##########
@@ -64,12 +65,14 @@ class CancellableTcpServer : public utils::net::TcpServer {
logger_->log_error("Error during accepting new connection: %s",
accept_error.message());
break;
}
+ std::error_code error;
+ auto remote_address =
socket.lowest_layer().remote_endpoint(error).address();
Review Comment:
should we check the `error` code?
--
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]