From 0f53cd0517cfa5ab2b56615488b0bacb758b54bc Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 26 Apr 2018 19:45:36 +0200 Subject: [PATCH] win, pipe: stop read for overlapped pipe Adds CancelIoEx call when uv_read_stop on overlapped pipe. Refs: https://github.com/nodejs/node/pull/19377 PR-URL: https://github.com/libuv/libuv/pull/1822 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/win/pipe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/win/pipe.c b/src/win/pipe.c index 0ecfbf1f..83ee4f99 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -735,6 +735,13 @@ void uv__pipe_unpause_read(uv_pipe_t* handle) { void uv__pipe_stop_read(uv_pipe_t* handle) { + if (pCancelIoEx && + !(handle->flags & UV_HANDLE_NON_OVERLAPPED_PIPE) && + !(handle->flags & UV_HANDLE_EMULATE_IOCP) && + handle->flags & UV_HANDLE_READING && + handle->read_req.type == UV_READ) { + pCancelIoEx(handle->handle, &handle->read_req.u.io.overlapped); + } handle->flags &= ~UV_HANDLE_READING; uv__pipe_pause_read((uv_pipe_t*)handle); uv__pipe_unpause_read((uv_pipe_t*)handle);