diff --git a/arangod/Agency/AgencyComm.cpp b/arangod/Agency/AgencyComm.cpp index 4ee85ba3d1..d46ca3f133 100644 --- a/arangod/Agency/AgencyComm.cpp +++ b/arangod/Agency/AgencyComm.cpp @@ -329,6 +329,7 @@ AgencyCommResult::AgencyCommResult() _values(), _statusCode(0), _connected(false), + _sent(false), _clientId("") {} AgencyCommResult::AgencyCommResult( @@ -339,6 +340,7 @@ AgencyCommResult::AgencyCommResult( _values(), _statusCode(code), _connected(false), + _sent(false), _clientId(clientId) {} bool AgencyCommResult::connected() const { return _connected; } @@ -347,6 +349,8 @@ std::string AgencyCommResult::clientId() const { return _clientId; } int AgencyCommResult::httpCode() const { return _statusCode; } +bool AgencyCommResult::sent() const { return _sent; } + int AgencyCommResult::errorCode() const { try { std::shared_ptr bodyBuilder = @@ -409,6 +413,8 @@ void AgencyCommResult::clear() { _message = ""; _body = ""; _statusCode = 0; + _sent = false; + _connected = false; } VPackSlice AgencyCommResult::slice() const { return _vpack->slice(); } @@ -1369,7 +1375,7 @@ AgencyCommResult AgencyComm::sendWithFailover( } // break on a watch timeout (drop connection) - if (!clientId.empty() && + if (!clientId.empty() && result._sent && (result._statusCode == 0 || result._statusCode == 503)) { VPackBuilder b; @@ -1484,8 +1490,7 @@ AgencyCommResult AgencyComm::send( TRI_ASSERT(!url.empty()); AgencyCommResult result; - result._connected = false; - result._statusCode = 0; + if (!clientId.empty()) { result._clientId = clientId; } @@ -1526,6 +1531,7 @@ AgencyCommResult AgencyComm::send( return result; } + result._sent = response->haveSentRequestFully(); result._connected = true; if (response->getHttpReturnCode() == diff --git a/arangod/Agency/AgencyComm.h b/arangod/Agency/AgencyComm.h index 7069a41f8b..2e13257d9c 100644 --- a/arangod/Agency/AgencyComm.h +++ b/arangod/Agency/AgencyComm.h @@ -243,6 +243,8 @@ class AgencyCommResult { std::string const body() const { return _body; } std::string const& bodyRef() const { return _body; } + bool sent() const; + void clear(); VPackSlice slice() const; @@ -257,6 +259,7 @@ class AgencyCommResult { std::map _values; int _statusCode; bool _connected; + bool _sent; private: std::shared_ptr _vpack;