summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-03-10 17:51:47 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-03-10 17:51:47 -0700
commite2fcfea46e334743aed24993eeebb2482c6ea762 (patch)
tree1cc7bf777b99845e9dcf9096b69b15af69d9572d /src
parentd2f2a32b897840d91cf240830ad5cf5f0e33a0c8 (diff)
downloadandroid-node-v8-e2fcfea46e334743aed24993eeebb2482c6ea762.tar.gz
android-node-v8-e2fcfea46e334743aed24993eeebb2482c6ea762.tar.bz2
android-node-v8-e2fcfea46e334743aed24993eeebb2482c6ea762.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/stream_wrap.cc21
-rw-r--r--src/stream_wrap.h4
2 files changed, 8 insertions, 17 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index 62193fd796..349b098b68 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -93,12 +93,7 @@ void StreamWrap::ReadStart(const FunctionCallbackInfo<Value>& args) {
StreamWrap* wrap = Unwrap<StreamWrap>(args.This());
- int err;
- if (wrap->is_named_pipe_ipc()) {
- err = uv_read2_start(wrap->stream(), OnAlloc, OnRead2);
- } else {
- err = uv_read_start(wrap->stream(), OnAlloc, OnRead);
- }
+ int err = uv_read_start(wrap->stream(), OnAlloc, OnRead);
args.GetReturnValue().Set(err);
}
@@ -169,15 +164,15 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
void StreamWrap::OnRead(uv_stream_t* handle,
ssize_t nread,
const uv_buf_t* buf) {
- OnReadCommon(handle, nread, buf, UV_UNKNOWN_HANDLE);
-}
+ StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
+ uv_handle_type type = UV_UNKNOWN_HANDLE;
+ if (wrap->is_named_pipe_ipc() &&
+ uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
+ type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
+ }
-void StreamWrap::OnRead2(uv_pipe_t* handle,
- ssize_t nread,
- const uv_buf_t* buf,
- uv_handle_type pending) {
- OnReadCommon(reinterpret_cast<uv_stream_t*>(handle), nread, buf, pending);
+ OnReadCommon(handle, nread, buf, type);
}
diff --git a/src/stream_wrap.h b/src/stream_wrap.h
index 92159fe117..3a7f6f8638 100644
--- a/src/stream_wrap.h
+++ b/src/stream_wrap.h
@@ -178,10 +178,6 @@ class StreamWrap : public HandleWrap {
static void OnRead(uv_stream_t* handle,
ssize_t nread,
const uv_buf_t* buf);
- static void OnRead2(uv_pipe_t* handle,
- ssize_t nread,
- const uv_buf_t* buf,
- uv_handle_type pending);
static void OnReadCommon(uv_stream_t* handle,
ssize_t nread,
const uv_buf_t* buf,