arpadboda commented on a change in pull request #615: MINIFICPP-963 - Zero byte 
(no content) flow files cannot be received …
URL: https://github.com/apache/nifi-minifi-cpp/pull/615#discussion_r305374735
 
 

 ##########
 File path: libminifi/src/sitetosite/SiteToSiteClient.cpp
 ##########
 @@ -215,31 +215,34 @@ bool SiteToSiteClient::confirm(std::string 
transactionID) {
 
   if (it == known_transactions_.end()) {
     return false;
-  } else {
-    transaction = it->second;
   }
+  transaction = it->second;
 
-  if (transaction->getState() == TRANSACTION_STARTED && 
!transaction->isDataAvailable() && transaction->getDirection() == RECEIVE) {
+
+  if (transaction->getState() == TRANSACTION_STARTED && 
!transaction->isDataAvailable() &&
+      transaction->getDirection() == RECEIVE) {
     transaction->_state = TRANSACTION_CONFIRMED;
     return true;
   }
 
-  if (transaction->getState() != DATA_EXCHANGED)
+  if (transaction->getState() != DATA_EXCHANGED) {
     return false;
+  }
 
   if (transaction->getDirection() == RECEIVE) {
-    if (transaction->isDataAvailable())
+    if (transaction->isDataAvailable()) {
       return false;
+    }
     // we received a FINISH_TRANSACTION indicator. Send back a 
CONFIRM_TRANSACTION message
     // to peer so that we can verify that the connection is still open. This 
is a two-phase commit,
     // which helps to prevent the chances of data duplication. Without doing 
this, we may commit the
     // session and then when we send the response back to the peer, the peer 
may have timed out and may not
     // be listening. As a result, it will re-send the data. By doing this 
two-phase commit, we narrow the
     // Critical Section involved in this transaction so that rather than the 
Critical Section being the
     // time window involved in the entire transaction, it is reduced to a 
simple round-trip conversation.
-    int64_t crcValue = transaction->getCRC();
+    uint64_t crcValue = transaction->getCRC();
     std::string crc = std::to_string(crcValue);
-    logger_->log_debug("Site2Site Send confirm with CRC %d to transaction %s", 
transaction->getCRC(), transactionID);
+    logger_->log_debug("Site2Site Receive confirm with CRC %llu to transaction 
%s", crcValue, transactionID);
 
 Review comment:
   This one line contained so many issues that I feel sad for fixing it, should 
be kept as a memento. :)

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to