int newRemoteClientIndex=-1;
for (newRemoteClientIndex=0; newRemoteClientIndex < remoteClientsLength; newRemoteClientIndex++)
{
remoteClients[newRemoteClientIndex].isActiveMutex.Lock();
if (remoteClients[newRemoteClientIndex].isActive==false)
{
remoteClients[newRemoteClientIndex].SetActive(true);
remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
break;
}
remoteClients[newRemoteClientIndex].isActiveMutex.Unlock();
}
if (newRemoteClientIndex==-1)
return UNASSIGNED_SYSTEM_ADDRESS;
if all removeClients is inactive then newRemoteClientIndex==remoteClientsLength. But the code doesn't check for that. And use newRemoteClientIndex as usual.
if all
removeClients
is inactive thennewRemoteClientIndex==remoteClientsLength
. But the code doesn't check for that. And usenewRemoteClientIndex
as usual.