@@ -242,13 +242,18 @@ void StreamWrap::OnReadImpl(ssize_t nread,
242242}
243243
244244
245- void StreamWrap::OnReadCommon (uv_stream_t * handle,
246- ssize_t nread,
247- const uv_buf_t * buf,
248- uv_handle_type pending) {
245+ void StreamWrap::OnRead (uv_stream_t * handle,
246+ ssize_t nread,
247+ const uv_buf_t * buf) {
249248 StreamWrap* wrap = static_cast <StreamWrap*>(handle->data );
250249 HandleScope scope (wrap->env ()->isolate ());
251250 Context::Scope context_scope (wrap->env ()->context ());
251+ uv_handle_type type = UV_UNKNOWN_HANDLE;
252+
253+ if (wrap->is_named_pipe_ipc () &&
254+ uv_pipe_pending_count (reinterpret_cast <uv_pipe_t *>(handle)) > 0 ) {
255+ type = uv_pipe_pending_type (reinterpret_cast <uv_pipe_t *>(handle));
256+ }
252257
253258 // We should not be getting this callback if someone as already called
254259 // uv_close() on the handle.
@@ -262,22 +267,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
262267 }
263268 }
264269
265- static_cast <StreamBase*>(wrap)->OnRead (nread, buf, pending);
266- }
267-
268-
269- void StreamWrap::OnRead (uv_stream_t * handle,
270- ssize_t nread,
271- const uv_buf_t * buf) {
272- StreamWrap* wrap = static_cast <StreamWrap*>(handle->data );
273- uv_handle_type type = UV_UNKNOWN_HANDLE;
274-
275- if (wrap->is_named_pipe_ipc () &&
276- uv_pipe_pending_count (reinterpret_cast <uv_pipe_t *>(handle)) > 0 ) {
277- type = uv_pipe_pending_type (reinterpret_cast <uv_pipe_t *>(handle));
278- }
279-
280- OnReadCommon (handle, nread, buf, type);
270+ static_cast <StreamBase*>(wrap)->OnRead (nread, buf, type);
281271}
282272
283273
0 commit comments