1
0
Fork 0

removed a few over-eager asserts

This commit is contained in:
Jan Steemann 2014-01-07 11:57:42 +01:00
parent 4f3cd8ffc9
commit 7c27a646f7
2 changed files with 19 additions and 3 deletions

View File

@ -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 = "";

View File

@ -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);