Skip to content
Snippets Groups Projects
Commit 7b5eb719 authored by Craig Tiller's avatar Craig Tiller
Browse files

Increment 'try' variable

To ensure that we actually probe different ports
parent 2e165e34
No related branches found
No related tags found
No related merge requests found
......@@ -117,9 +117,10 @@ int grpc_pick_unused_port(void) {
for (;;) {
int port;
if (try == 0) {
try++;
if (try == 1) {
port = getpid() % (65536 - 30000) + 30000;
} else if (try < NUM_RANDOM_PORTS_TO_PICK) {
} else if (try <= NUM_RANDOM_PORTS_TO_PICK) {
port = rand() % (65536 - 30000) + 30000;
} else {
port = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment