From 6445cc63080f35370d38434666fa4ae9f7b3f41c Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Fri, 17 Jul 2015 22:21:54 -0400 Subject: [PATCH] win, pipe: null-initialize stream->shutdown_req When initializing a stream on Windows, this also inits the shutdown_req field, instead of waiting for a successful connection. A NULL value is used as a sentinel to check for whether this handle is currently in the shutdown state, and it may not get set if a stream was not connected immediately. PR-URL: https://github.com/libuv/libuv/pull/1500 Reviewed-By: Colin Ihrig Reviewed-By: Bartosz Sosnowski --- src/win/stream-inl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/win/stream-inl.h b/src/win/stream-inl.h index bf12148a..dba03747 100644 --- a/src/win/stream-inl.h +++ b/src/win/stream-inl.h @@ -36,6 +36,7 @@ INLINE static void uv_stream_init(uv_loop_t* loop, uv__handle_init(loop, (uv_handle_t*) handle, type); handle->write_queue_size = 0; handle->activecnt = 0; + handle->stream.conn.shutdown_req = NULL; } @@ -47,8 +48,6 @@ INLINE static void uv_connection_init(uv_stream_t* handle) { handle->read_req.event_handle = NULL; handle->read_req.wait_handle = INVALID_HANDLE_VALUE; handle->read_req.data = handle; - - handle->stream.conn.shutdown_req = NULL; }