fgerlits commented on a change in pull request #1028: URL: https://github.com/apache/nifi-minifi-cpp/pull/1028#discussion_r596108625
########## File path: libminifi/src/sitetosite/SiteToSiteClient.cpp ########## @@ -31,47 +31,43 @@ namespace sitetosite { int SiteToSiteClient::readResponse(const std::shared_ptr<Transaction>& /*transaction*/, RespondCode &code, std::string &message) { uint8_t firstByte; - - int ret = peer_->read(firstByte); - - if (ret <= 0 || firstByte != CODE_SEQUENCE_VALUE_1) - return -1; + { + const auto ret = peer_->read(firstByte); + if (ret == 0 || io::isError(ret) || firstByte != CODE_SEQUENCE_VALUE_1) + return -1; + } uint8_t secondByte; - - ret = peer_->read(secondByte); - - if (ret <= 0 || secondByte != CODE_SEQUENCE_VALUE_2) - return -1; + { + const auto ret = peer_->read(secondByte); + if (ret == 0 || io::isError(ret) || secondByte != CODE_SEQUENCE_VALUE_2) + return -1; + } uint8_t thirdByte; - - ret = peer_->read(thirdByte); - - if (ret <= 0) - return ret; + { + const auto ret = peer_->read(thirdByte); + if (ret == 0 || io::isError(ret)) + return static_cast<int>(ret); + } code = (RespondCode) thirdByte; - RespondCodeContext *resCode = this->getRespondCodeContext(code); - - if (resCode == NULL) { - // Not a valid respond code + if (!resCode) { return -1; } if (resCode->hasDescription) { - ret = peer_->read(message); - if (ret <= 0) + const auto ret = peer_->read(message); + if (ret == 0 || !io::isError(ret)) Review comment: ```suggestion if (ret == 0 || io::isError(ret)) ``` ########## File path: libminifi/test/rocksdb-tests/DBContentRepositoryTests.cpp ########## @@ -140,7 +140,7 @@ TEST_CASE("Test Empty Claim", "[TestDBCR3]") { std::string readstr; // -1 tell us we have an invalid stream Review comment: minor, but you changed "-1" to "error" in the other place -- should be changed here, too ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org