Increment 'try' variable

To ensure that we actually probe different ports
pull/872/head
Craig Tiller 10 years ago
parent 2e165e3401
commit 7b5eb7193c
  1. 5
      test/core/util/port_posix.c

@ -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;

Loading…
Cancel
Save