src: remove unnecessary helper function · nodejs/node@968121b

Original file line numberDiff line numberDiff line change

@@ -222,13 +222,18 @@ void StreamWrap::OnReadImpl(ssize_t nread,

222222

}

223223
224224
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) {

229228

StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);

230229

HandleScope scope(wrap->env()->isolate());

231230

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+

}

232237
233238

// We should not be getting this callback if someone as already called

234239

// uv_close() on the handle.

@@ -242,22 +247,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,

242247

}

243248

}

244249
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);

261251

}

262252
263253