Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/icelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4522,10 +4522,14 @@ bool
ICELIB_isNominatingCriteriaMet(ICELIB_VALIDLIST* pValidList,
ICELIB_CHECKLIST* pCheckList)
{
/* This is iffy, must change all of this. Just to get going... */
bool compOk[ICE_MAX_COMPONENTS];
/*
* Ready to nominate if at least one of the below is true:
* 1. We've validated the pair with the highest priority
* 2. All pairs have finished (failed or succeeded) and we have at least one valid one
*/
bool have_highest_priority_pair[ICE_MAX_COMPONENTS];

memset(&compOk, 0, sizeof compOk);
memset(&have_highest_priority_pair, 0, sizeof have_highest_priority_pair);

for (uint32_t i = 0; i < pCheckList->componentList.numberOfComponents; i++)
{
Expand All @@ -4537,19 +4541,26 @@ ICELIB_isNominatingCriteriaMet(ICELIB_VALIDLIST* pValidList,
if ( (pValidList->pairs.elements[j].pairPriority == max_priority) &&
(pValidList->pairs.elements[j].pLocalCandidate->componentid == id) )
{
compOk[i] = true;
have_highest_priority_pair[i] = true;
}
}
}

bool have_highest_priority_for_all_components = true;
for (uint32_t i = 0; i < pCheckList->componentList.numberOfComponents; i++)
{
if (compOk[i] == false)
if (!have_highest_priority_pair[i])
{
return false;
have_highest_priority_for_all_components = false;
break;
}
}
return true;
if (have_highest_priority_for_all_components)
{
return true;
}

return ICELIB_isAllPairsFailedOrSucceded(pCheckList);
}

bool
Expand Down