lordgamez commented on code in PR #1595:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1595#discussion_r1283171762
##########
libminifi/src/io/InputStream.cpp:
##########
@@ -71,18 +67,20 @@ size_t InputStream::read(std::string &str, bool widen) {
return length_return;
}
- std::vector<std::byte> buffer(string_length);
- const auto read_return = read(buffer);
- if (read_return != string_length) {
- return read_return;
+ str.clear();
+ str.reserve(string_length);
+
+ auto bytes_to_read = string_length;
+ while (bytes_to_read > 0) {
+ std::vector<std::byte> buffer(bytes_to_read);
+ const auto read_return = read(buffer);
+ if (io::isError(read_return))
+ return read_return;
+ bytes_to_read -= read_return;
+ str.append(std::string(reinterpret_cast<const char*>(buffer.data()),
read_return));
Review Comment:
Added retry counter in 0fef6eb9ae735800ca069c868f1e9eca4930d10c
--
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]