diff options
Diffstat (limited to 'test/core/util/reconnect_server.c')
-rw-r--r-- | test/core/util/reconnect_server.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c index a06cb50b3a..71fb69b54f 100644 --- a/test/core/util/reconnect_server.c +++ b/test/core/util/reconnect_server.c @@ -33,7 +33,6 @@ #include "test/core/util/reconnect_server.h" -#include <arpa/inet.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> @@ -42,6 +41,7 @@ #include <grpc/support/time.h> #include <string.h> #include "src/core/iomgr/endpoint.h" +#include "src/core/iomgr/sockaddr.h" #include "src/core/iomgr/tcp_server.h" #include "test/core/util/port.h" @@ -81,7 +81,8 @@ static void on_connect(void *arg, grpc_endpoint *tcp) { } else { if (last_colon == NULL) { gpr_log(GPR_ERROR, "peer does not contain a ':'"); - } else if (strncmp(server->peer, peer, last_colon - peer) != 0) { + } else if (strncmp(server->peer, peer, (size_t)(last_colon - peer)) != + 0) { gpr_log(GPR_ERROR, "mismatched peer! %s vs %s", server->peer, peer); } gpr_free(peer); @@ -115,8 +116,8 @@ void reconnect_server_start(reconnect_server *server, int port) { int port_added; addr.sin_family = AF_INET; - addr.sin_port = htons(port); - inet_pton(AF_INET, "0.0.0.0", &addr.sin_addr); + addr.sin_port = htons((gpr_uint16)port); + memset(&addr.sin_addr, 0, sizeof(addr.sin_addr)); server->tcp_server = grpc_tcp_server_create(); port_added = |