@@ -222,13 +222,18 @@ void StreamWrap::OnReadImpl(ssize_t nread,
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
225 | | -void StreamWrap::OnReadCommon(uv_stream_t* handle, |
226 | | -ssize_t nread, |
227 | | -const uv_buf_t* buf, |
228 | | - uv_handle_type pending) { |
| 225 | +void StreamWrap::OnRead(uv_stream_t* handle, |
| 226 | +ssize_t nread, |
| 227 | +const uv_buf_t* buf) { |
229 | 228 | StreamWrap* wrap = static_cast<StreamWrap*>(handle->data); |
230 | 229 | HandleScope scope(wrap->env()->isolate()); |
231 | 230 | Context::Scope context_scope(wrap->env()->context()); |
| 231 | + uv_handle_type type = UV_UNKNOWN_HANDLE; |
| 232 | + |
| 233 | +if (wrap->is_named_pipe_ipc() && |
| 234 | +uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) { |
| 235 | + type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle)); |
| 236 | + } |
232 | 237 | |
233 | 238 | // We should not be getting this callback if someone as already called |
234 | 239 | // uv_close() on the handle. |
@@ -242,22 +247,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
|
242 | 247 | } |
243 | 248 | } |
244 | 249 | |
245 | | -static_cast<StreamBase*>(wrap)->OnRead(nread, buf, pending); |
246 | | -} |
247 | | - |
248 | | - |
249 | | -void StreamWrap::OnRead(uv_stream_t* handle, |
250 | | -ssize_t nread, |
251 | | -const uv_buf_t* buf) { |
252 | | - StreamWrap* wrap = static_cast<StreamWrap*>(handle->data); |
253 | | - uv_handle_type type = UV_UNKNOWN_HANDLE; |
254 | | - |
255 | | -if (wrap->is_named_pipe_ipc() && |
256 | | -uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) { |
257 | | - type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle)); |
258 | | - } |
259 | | - |
260 | | -OnReadCommon(handle, nread, buf, type); |
| 250 | +static_cast<StreamBase*>(wrap)->OnRead(nread, buf, type); |
261 | 251 | } |
262 | 252 | |
263 | 253 | |
|