From d9e7943994b8bbd79b3785bfc4e2166c0652cf24 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Sun, 12 Jul 2015 01:27:30 -0700 Subject: [PATCH 1/2] remove chatty log messages on windows --- src/core/iomgr/iocp_windows.c | 1 - src/core/iomgr/tcp_windows.c | 24 +++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index 0c62bfccd51..3d3a193d00d 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -127,7 +127,6 @@ static void iocp_loop(void *p) { grpc_maybe_call_delayed_callbacks(NULL, 1); do_iocp_work(); } - gpr_log(GPR_DEBUG, "iocp_loop is done"); gpr_event_set(&g_iocp_done, (void *)1); } diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 15759c398a1..1bf81a73e0c 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -148,9 +148,11 @@ static void on_read(void *tcpp, int from_iocp) { GPR_ASSERT(tcp->socket->read_info.outstanding); if (socket->read_info.wsa_error != 0) { - char *utf8_message = gpr_format_message(info->wsa_error); - gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message); - gpr_free(utf8_message); + if (socket->read_info.wsa_error != WSAECONNRESET) { + char *utf8_message = gpr_format_message(info->wsa_error); + gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message); + gpr_free(utf8_message); + } status = GRPC_ENDPOINT_CB_ERROR; } else { if (info->bytes_transfered != 0) { @@ -259,9 +261,11 @@ static void on_write(void *tcpp, int from_iocp) { GPR_ASSERT(tcp->socket->write_info.outstanding); if (info->wsa_error != 0) { - char *utf8_message = gpr_format_message(info->wsa_error); - gpr_log(GPR_ERROR, "WSASend overlapped error: %s", utf8_message); - gpr_free(utf8_message); + if (info->wsa_error != WSAECONNRESET) { + char *utf8_message = gpr_format_message(info->wsa_error); + gpr_log(GPR_ERROR, "WSASend overlapped error: %s", utf8_message); + gpr_free(utf8_message); + } status = GRPC_ENDPOINT_CB_ERROR; } else { GPR_ASSERT(info->bytes_transfered == tcp->write_slices.length); @@ -325,9 +329,11 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, ret = GRPC_ENDPOINT_WRITE_DONE; GPR_ASSERT(bytes_sent == tcp->write_slices.length); } else { - char *utf8_message = gpr_format_message(info->wsa_error); - gpr_log(GPR_ERROR, "WSASend error: %s", utf8_message); - gpr_free(utf8_message); + if (socket->read_info.wsa_error != WSAECONNRESET) { + char *utf8_message = gpr_format_message(info->wsa_error); + gpr_log(GPR_ERROR, "WSASend error: %s", utf8_message); + gpr_free(utf8_message); + } } if (allocated) gpr_free(allocated); gpr_slice_buffer_reset_and_unref(&tcp->write_slices); From 80e5f044a4f7ee5e1b81a3da8f930d216ca01849 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Sun, 12 Jul 2015 01:28:05 -0700 Subject: [PATCH 2/2] zero-out channel after creation --- src/core/surface/channel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c index eeae3b507cc..b7826d4dfc9 100644 --- a/src/core/surface/channel.c +++ b/src/core/surface/channel.c @@ -91,6 +91,7 @@ grpc_channel *grpc_channel_create_from_filters( size_t size = sizeof(grpc_channel) + grpc_channel_stack_size(filters, num_filters); grpc_channel *channel = gpr_malloc(size); + memset(channel, 0, sizeof(*channel)); GPR_ASSERT(grpc_is_initialized() && "call grpc_init()"); channel->is_client = is_client; /* decremented by grpc_channel_destroy */