aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2016-10-28 08:43:01 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2016-10-28 08:43:01 -0700
commit85fe038342d307ea69dfee5bc2f1a0ff778cd409 (patch)
tree839103c24214f32e518dd9c1ec6bfd11456f0792 /src
parenta5ea56b68f0159f03da8442469ac4341e284b275 (diff)
Fix some other Windows bugs while we're here
Diffstat (limited to 'src')
-rw-r--r--src/core/lib/iomgr/tcp_client_windows.c2
-rw-r--r--src/core/lib/iomgr/tcp_server_windows.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/src/core/lib/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c
index 620b38c825..f5145abdc5 100644
--- a/src/core/lib/iomgr/tcp_client_windows.c
+++ b/src/core/lib/iomgr/tcp_client_windows.c
@@ -194,7 +194,7 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *on_done,
grpc_sockaddr_make_wildcard6(0, &local_address);
status =
- bind(sock, (struct sockaddr *)&local_address.addr, local_address.len);
+ bind(sock, (struct sockaddr *)&local_address.addr, (int)local_address.len);
if (status != 0) {
error = GRPC_WSA_ERROR(WSAGetLastError(), "bind");
goto failure;
diff --git a/src/core/lib/iomgr/tcp_server_windows.c b/src/core/lib/iomgr/tcp_server_windows.c
index 21d4f8bd71..4f04ecc03d 100644
--- a/src/core/lib/iomgr/tcp_server_windows.c
+++ b/src/core/lib/iomgr/tcp_server_windows.c
@@ -226,12 +226,13 @@ static grpc_error *prepare_socket(SOCKET sock,
goto failure;
}
- sockname_temp.len = sizeof(struct sockaddr_storage);
+ int sockname_temp_len = sizeof(struct sockaddr_storage);
if (getsockname(sock, (struct sockaddr *)sockname_temp.addr,
- &sockname_temp.len) == SOCKET_ERROR) {
+ &sockname_temp_len) == SOCKET_ERROR) {
error = GRPC_WSA_ERROR(WSAGetLastError(), "getsockname");
goto failure;
}
+ sockname_temp.len = sockname_temp_len;
*port = grpc_sockaddr_get_port(&sockname_temp);
return GRPC_ERROR_NONE;
@@ -376,8 +377,10 @@ static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
gpr_log(GPR_ERROR, "setsockopt error: %s", utf8_message);
gpr_free(utf8_message);
}
+ int peer_name_len = (int) peer_name.len;
err =
- getpeername(sock, (struct sockaddr *)peer_name.addr, &peer_name.len);
+ getpeername(sock, (struct sockaddr *)peer_name.addr, &peer_name_len);
+ peer_name.len = peer_name_len;
if (!err) {
peer_name_string = grpc_sockaddr_to_uri(&peer_name);
} else {
@@ -485,10 +488,11 @@ grpc_error *grpc_tcp_server_add_port(grpc_tcp_server *s,
as some previously created listener. */
if (grpc_sockaddr_get_port(addr) == 0) {
for (sp = s->head; sp; sp = sp->next) {
- sockname_temp.len = sizeof(struct sockaddr_storage);
+ int sockname_temp_len = sizeof(struct sockaddr_storage);
if (0 == getsockname(sp->socket->socket,
(struct sockaddr *)sockname_temp.addr,
- &sockname_temp.len)) {
+ &sockname_temp_len)) {
+ sockname_temp.len = sockname_temp_len;
*port = grpc_sockaddr_get_port(&sockname_temp);
if (*port > 0) {
allocated_addr = gpr_malloc(sizeof(grpc_resolved_address));