clang-format

pull/8852/head
David Garcia Quintas 8 years ago
parent 6ff81e91c9
commit 8fe2a4285c
  1. 14
      test/core/util/port_posix.c

@ -127,9 +127,9 @@ static bool is_port_available(int *port, bool is_tcp) {
on each supported family. */ on each supported family. */
bool got_socket = false; bool got_socket = false;
for (int is_ipv6 = 1; is_ipv6 >= 0; is_ipv6--) { for (int is_ipv6 = 1; is_ipv6 >= 0; is_ipv6--) {
const int fd = socket(is_ipv6 ? AF_INET6 : AF_INET, const int fd =
is_tcp ? SOCK_STREAM : SOCK_DGRAM, socket(is_ipv6 ? AF_INET6 : AF_INET, is_tcp ? SOCK_STREAM : SOCK_DGRAM,
is_tcp ? IPPROTO_TCP : 0); is_tcp ? IPPROTO_TCP : 0);
if (fd >= 0) { if (fd >= 0) {
got_socket = true; got_socket = true;
} else { } else {
@ -147,9 +147,9 @@ static bool is_port_available(int *port, bool is_tcp) {
/* Try binding to port */ /* Try binding to port */
grpc_resolved_address addr; grpc_resolved_address addr;
if (is_ipv6) { if (is_ipv6) {
grpc_sockaddr_make_wildcard6(*port, &addr); /* [::]:port */ grpc_sockaddr_make_wildcard6(*port, &addr); /* [::]:port */
} else { } else {
grpc_sockaddr_make_wildcard4(*port, &addr); /* 0.0.0.0:port */ grpc_sockaddr_make_wildcard4(*port, &addr); /* 0.0.0.0:port */
} }
if (bind(fd, (struct sockaddr *)addr.addr, (socklen_t)addr.len) < 0) { if (bind(fd, (struct sockaddr *)addr.addr, (socklen_t)addr.len) < 0) {
gpr_log(GPR_DEBUG, "bind(port=%d) failed: %s", *port, strerror(errno)); gpr_log(GPR_DEBUG, "bind(port=%d) failed: %s", *port, strerror(errno));
@ -158,8 +158,8 @@ static bool is_port_available(int *port, bool is_tcp) {
} }
/* Get the bound port number */ /* Get the bound port number */
if (getsockname(fd, (struct sockaddr *)addr.addr, if (getsockname(fd, (struct sockaddr *)addr.addr, (socklen_t *)&addr.len) <
(socklen_t *)&addr.len) < 0) { 0) {
gpr_log(GPR_ERROR, "getsockname() failed: %s", strerror(errno)); gpr_log(GPR_ERROR, "getsockname() failed: %s", strerror(errno));
close(fd); close(fd);
return false; return false;

Loading…
Cancel
Save