mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 02:33:19 +02:00
fix index randomization for single candidate ice-server
This commit is contained in:
parent
6ef9fbfcc0
commit
f1209dc82d
1 changed files with 8 additions and 5 deletions
|
@ -2110,13 +2110,16 @@ void DomainServer::randomizeICEServerAddress() {
|
|||
}
|
||||
|
||||
// of the list of available addresses that we haven't tried, pick a random one
|
||||
int maxIndex = candidateICEAddresses.size();
|
||||
int maxIndex = candidateICEAddresses.size() - 1;
|
||||
int indexToTry = 0;
|
||||
|
||||
static std::random_device randomDevice;
|
||||
static std::mt19937 generator(randomDevice());
|
||||
std::uniform_int_distribution<> distribution(0, maxIndex);
|
||||
if (maxIndex > 0) {
|
||||
static std::random_device randomDevice;
|
||||
static std::mt19937 generator(randomDevice());
|
||||
std::uniform_int_distribution<> distribution(0, maxIndex);
|
||||
|
||||
auto indexToTry = distribution(generator);
|
||||
indexToTry = distribution(generator);
|
||||
}
|
||||
|
||||
_iceServerSocket = HifiSockAddr { candidateICEAddresses[indexToTry], ICE_SERVER_DEFAULT_PORT };
|
||||
qInfo() << "Set candidate ice-server socket to" << _iceServerSocket;
|
||||
|
|
Loading…
Reference in a new issue