Merge pull request #22363 from jtattermusch/win_rbe_port_blacklist

Blacklist a port that cannot be bound on WinRBE
pull/22385/head
Jan Tattermusch 5 years ago committed by GitHub
commit f2751504c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      test/core/util/port_isolated_runtime_environment.cc

@ -43,7 +43,7 @@ static int get_random_port_offset() {
static int s_initial_offset = get_random_port_offset();
static gpr_atm s_pick_counter = 0;
int grpc_pick_unused_port_or_die(void) {
static int grpc_pick_unused_port_or_die_impl(void) {
int orig_counter_val =
static_cast<int>(gpr_atm_full_fetch_add(&s_pick_counter, 1));
GPR_ASSERT(orig_counter_val < (MAX_PORT - MIN_PORT + 1));
@ -51,6 +51,19 @@ int grpc_pick_unused_port_or_die(void) {
(s_initial_offset + orig_counter_val) % (MAX_PORT - MIN_PORT + 1);
}
int grpc_pick_unused_port_or_die(void) {
while (true) {
int port = grpc_pick_unused_port_or_die_impl();
// 5985 cannot be bound on Windows RBE and results in
// WSA_ERROR 10013: "An attempt was made to access a socket in a way
// forbidden by its access permissions."
if (port == 5985) {
continue;
}
return port;
}
}
void grpc_recycle_unused_port(int port) { (void)port; }
#endif /* GRPC_PORT_ISOLATED_RUNTIME */

Loading…
Cancel
Save