Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit e2fcfea

Browse files
committed
src: update from uv_read2_start removal
Previously if you wanted to be notified of pending handles for pipes you needed to use uv_read2_start, however in v0.11.22 you can query for pending handles independently.
1 parent d2f2a32 commit e2fcfea

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/stream_wrap.cc

+8-13
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ void StreamWrap::ReadStart(const FunctionCallbackInfo<Value>& args) {
9393

9494
StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
9595

96-
int err;
97-
if (wrap->is_named_pipe_ipc()) {
98-
err = uv_read2_start(wrap->stream(), OnAlloc, OnRead2);
99-
} else {
100-
err = uv_read_start(wrap->stream(), OnAlloc, OnRead);
101-
}
96+
int err = uv_read_start(wrap->stream(), OnAlloc, OnRead);
10297

10398
args.GetReturnValue().Set(err);
10499
}
@@ -169,15 +164,15 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
169164
void StreamWrap::OnRead(uv_stream_t* handle,
170165
ssize_t nread,
171166
const uv_buf_t* buf) {
172-
OnReadCommon(handle, nread, buf, UV_UNKNOWN_HANDLE);
173-
}
167+
StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
168+
uv_handle_type type = UV_UNKNOWN_HANDLE;
174169

170+
if (wrap->is_named_pipe_ipc() &&
171+
uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
172+
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
173+
}
175174

176-
void StreamWrap::OnRead2(uv_pipe_t* handle,
177-
ssize_t nread,
178-
const uv_buf_t* buf,
179-
uv_handle_type pending) {
180-
OnReadCommon(reinterpret_cast<uv_stream_t*>(handle), nread, buf, pending);
175+
OnReadCommon(handle, nread, buf, type);
181176
}
182177

183178

src/stream_wrap.h

-4
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ class StreamWrap : public HandleWrap {
178178
static void OnRead(uv_stream_t* handle,
179179
ssize_t nread,
180180
const uv_buf_t* buf);
181-
static void OnRead2(uv_pipe_t* handle,
182-
ssize_t nread,
183-
const uv_buf_t* buf,
184-
uv_handle_type pending);
185181
static void OnReadCommon(uv_stream_t* handle,
186182
ssize_t nread,
187183
const uv_buf_t* buf,

0 commit comments

Comments
 (0)