mirror of https://gitee.com/bigwinds/arangodb
removed a few over-eager asserts
This commit is contained in:
parent
4f3cd8ffc9
commit
7c27a646f7
|
@ -650,7 +650,9 @@ void AgencyComm::cleanup () {
|
|||
bool AgencyComm::tryConnect () {
|
||||
{
|
||||
WRITE_LOCKER(AgencyComm::_globalLock);
|
||||
assert(_globalEndpoints.size() > 0);
|
||||
if (_globalEndpoints.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list<AgencyEndpoint*>::iterator it = _globalEndpoints.begin();
|
||||
|
||||
|
@ -1473,9 +1475,13 @@ bool AgencyComm::sendWithFailover (triagens::rest::HttpRequest::HttpRequestType
|
|||
{
|
||||
READ_LOCKER(AgencyComm::_globalLock);
|
||||
numEndpoints = AgencyComm::_globalEndpoints.size();
|
||||
assert(numEndpoints > 0);
|
||||
if (numEndpoints == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
assert(numEndpoints > 0);
|
||||
|
||||
size_t tries = 0;
|
||||
std::string realUrl = url;
|
||||
std::string forceEndpoint = "";
|
||||
|
|
|
@ -177,6 +177,10 @@ std::string ServerState::stateToString (StateEnum state) {
|
|||
|
||||
void ServerState::flush () {
|
||||
WRITE_LOCKER(_lock);
|
||||
if (_id.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_address = ClusterInfo::instance()->getTargetServerEndpoint(_id);
|
||||
_role = determineRole(_id);
|
||||
}
|
||||
|
@ -256,7 +260,9 @@ std::string ServerState::getAddress () {
|
|||
}
|
||||
|
||||
// address not yet set
|
||||
assert(! id.empty());
|
||||
if (id.empty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// fetch and set the address
|
||||
const std::string address = ClusterInfo::instance()->getTargetServerEndpoint(id);
|
||||
|
@ -340,6 +346,10 @@ void ServerState::setState (StateEnum state) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ServerState::RoleEnum ServerState::determineRole (std::string const& id) {
|
||||
if (id.empty()) {
|
||||
return ServerState::ROLE_UNDEFINED;
|
||||
}
|
||||
|
||||
ServerState::RoleEnum role = checkServersList(id);
|
||||
ServerState::RoleEnum role2 = checkCoordinatorsList(id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue