static void free_chosen_ports(void) { size_t i; grpc_init(); for (i = 0; i < num_chosen_ports; i++) { grpc_free_port_using_server(chosen_ports[i]); } grpc_shutdown(); gpr_free(chosen_ports); }
static void free_chosen_ports(void) { char *env = gpr_getenv("GRPC_TEST_PORT_SERVER"); if (env != NULL) { size_t i; for (i = 0; i < num_chosen_ports; i++) { grpc_free_port_using_server(env, chosen_ports[i]); } gpr_free(env); } gpr_free(chosen_ports); }
static int free_chosen_port(int port) { size_t i; int found = 0; size_t found_at = 0; /* Find the port and erase it from the list, then tell the server it can be freed. */ for (i = 0; i < num_chosen_ports; i++) { if (chosen_ports[i] == port) { GPR_ASSERT(found == 0); found = 1; found_at = i; } } if (found) { chosen_ports[found_at] = chosen_ports[num_chosen_ports - 1]; num_chosen_ports--; grpc_free_port_using_server(port); } return found; }
static int free_chosen_port(int port) { size_t i; int found = 0; size_t found_at = 0; char *env = gpr_getenv("GRPC_TEST_PORT_SERVER"); if (env != NULL) { /* Find the port and erase it from the list, then tell the server it can be freed. */ for (i = 0; i < num_chosen_ports; i++) { if (chosen_ports[i] == port) { GPR_ASSERT(found == 0); found = 1; found_at = i; } } if (found) { chosen_ports[found_at] = chosen_ports[num_chosen_ports - 1]; grpc_free_port_using_server(env, port); num_chosen_ports--; } } return found; }