mirror of
https://github.com/overte-org/overte.git
synced 2025-07-10 20:38:37 +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
|
// 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;
|
if (maxIndex > 0) {
|
||||||
static std::mt19937 generator(randomDevice());
|
static std::random_device randomDevice;
|
||||||
std::uniform_int_distribution<> distribution(0, maxIndex);
|
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 };
|
_iceServerSocket = HifiSockAddr { candidateICEAddresses[indexToTry], ICE_SERVER_DEFAULT_PORT };
|
||||||
qInfo() << "Set candidate ice-server socket to" << _iceServerSocket;
|
qInfo() << "Set candidate ice-server socket to" << _iceServerSocket;
|
||||||
|
|
Loading…
Reference in a new issue