phrocker 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_r321295972
##########
File path: extensions/http-curl/sitetosite/HTTPProtocol.cpp
##########
@@ -242,37 +241,43 @@ void HttpSiteToSiteClient::closeTransaction(const
std::string &transactionID) {
if (it == known_transactions_.end()) {
return;
- } else {
- transaction = it->second;
- if (transaction->closed_) {
- return;
- }
+ }
+
+ transaction = it->second;
+ if (transaction->closed_) {
+ return;
}
std::string append_str;
- logger_->log_info("Site to Site closed transaction %s",
transaction->getUUIDStr());
+ logger_->log_trace("Site to Site closing transaction %s",
transaction->getUUIDStr());
+
+
+ bool data_received = transaction->getDirection() == RECEIVE && (current_code
== CONFIRM_TRANSACTION || current_code == TRANSACTION_FINISHED);
int code = UNRECOGNIZED_RESPONSE_CODE;
- if (transaction->getState() == TRANSACTION_CONFIRMED) {
+ // In case transaction was used to actually transmit data (conditions are a
bit different for send and receive to detect this),
+ // it has to be confirmed before closing.
+ // In case no data was transmitted, there is nothing to confirm, so the
transaction can be cancelled without confirming it.
+ // Confirm means matching CRC checksum of data at both sides.
+ if (transaction->getState() == TRANSACTION_CONFIRMED || data_received) {
Review comment:
nice good catch
----------------------------------------------------------------
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