Address review comments.

This commit is contained in:
Balachandar Namasivayam 2018-06-01 18:33:29 -07:00
parent 59bfa74197
commit 95f3668a3e
1 changed files with 3 additions and 4 deletions

View File

@ -353,7 +353,7 @@ Optional<std::pair<LeaderInfo, bool>> getLeader( const vector<Optional<LeaderInf
LeaderInfo currentNominee;
int curCount = 0;
for (int i = 0; i < maskedNominees.size(); i++) {
if (currentNominee.equalInternalId(maskedNominees[i])) {
if (currentNominee == maskedNominees[i]) {
curCount++;
}
else {
@ -370,9 +370,8 @@ Optional<std::pair<LeaderInfo, bool>> getLeader( const vector<Optional<LeaderInf
bestCount = curCount;
}
if (bestCount >= nominees.size() / 2 + 1)
return std::pair<LeaderInfo, bool>(bestNominee, true);
return std::pair<LeaderInfo, bool>(bestNominee, false);
bool majority = bestCount >= nominees.size() / 2 + 1;
return std::pair<LeaderInfo, bool>(bestNominee, majority);
}
struct MonitorLeaderInfo {