Skip to content

Commit

Permalink
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/grpc/support/port_platform.h
Original file line number Diff line number Diff line change
@@ -199,7 +199,7 @@
#endif

#if defined(GPR_POSIX_SOCKET) + defined(GPR_WIN32) != 1
#error Must define exactly one of GPR_POSIX_POLLSET, GPR_WIN32
#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WIN32
#endif

typedef int16_t gpr_int16;
7 changes: 4 additions & 3 deletions test/core/util/port_posix.c
Original file line number Diff line number Diff line change
@@ -32,7 +32,8 @@
*/

#include <grpc/support/port_platform.h>
#ifdef GPR_POSIX_SOCKET
#include "test/core/util/test_config.h"
#if defined(GPR_POSIX_SOCKET) && defined(GRPC_TEST_PICK_PORT)

#include "test/core/util/port.h"

@@ -125,7 +126,7 @@ int grpc_pick_unused_port(void) {
} else {
port = 0;
}

if (!is_port_available(&port, is_tcp)) {
continue;
}
@@ -155,4 +156,4 @@ int grpc_pick_unused_port_or_die(void) {
return port;
}

#endif /* GPR_POSIX_SOCKET */
#endif /* GPR_POSIX_SOCKET && GRPC_TEST_PICK_PORT */
4 changes: 4 additions & 0 deletions test/core/util/test_config.h
Original file line number Diff line number Diff line change
@@ -59,6 +59,10 @@ extern "C" {
gpr_time_add(gpr_now(), \
gpr_time_from_micros(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)))

#ifndef GRPC_TEST_CUSTOM_PICK_PORT
#define GRPC_TEST_PICK_PORT
#endif

void grpc_test_init(int argc, char **argv);

#ifdef __cplusplus

0 comments on commit 5a5032d

Please sign in to comment.