fgerlits commented on code in PR #1412:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1412#discussion_r980240978
##########
libminifi/test/Utils.h:
##########
@@ -111,24 +111,42 @@ bool countLogOccurrencesUntil(const std::string& pattern,
return false;
}
-bool sendMessagesViaTCP(const std::vector<std::string_view>& contents,
uint64_t port) {
+bool sendMessagesViaTCP(const std::vector<std::string_view>& contents, const
asio::ip::tcp::endpoint& remote_endpoint) {
asio::io_context io_context;
asio::ip::tcp::socket socket(io_context);
- asio::ip::tcp::endpoint
remote_endpoint(asio::ip::address::from_string("127.0.0.1"), port);
socket.connect(remote_endpoint);
std::error_code err;
for (auto& content : contents) {
std::string tcp_message(content);
tcp_message += '\n';
asio::write(socket, asio::buffer(tcp_message, tcp_message.size()), err);
Review Comment:
Won't this overwrite the previous value of `err`? I.e., if there are 2
writes, the first fails and the second succeeds, then we'll return `true` as if
everything was A-OK.
--
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]