diff --git a/src/node_file.cc b/src/node_file.cc index 8414a22ad4cd5f..17a44dd784f3ce 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1552,9 +1552,12 @@ static void WriteString(const FunctionCallbackInfo& args) { len = StringBytes::Write(env->isolate(), *stack_buffer, len, args[1], enc); stack_buffer.SetLengthAndZeroTerminate(len); uv_buf_t uvbuf = uv_buf_init(*stack_buffer, len); - int err = uv_fs_write(env->event_loop(), req_wrap_async->req(), - fd, &uvbuf, 1, pos, AfterInteger); - req_wrap_async->Dispatched(); + int err = req_wrap_async->Dispatch(uv_fs_write, + fd, + &uvbuf, + 1, + pos, + AfterInteger); if (err < 0) { uv_fs_t* uv_req = req_wrap_async->req(); uv_req->result = err; diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 2dea245fd1dddc..60a17545427b16 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -276,10 +276,7 @@ WriteWrap* LibuvStreamWrap::CreateWriteWrap(Local object) { int LibuvStreamWrap::DoShutdown(ShutdownWrap* req_wrap_) { LibuvShutdownWrap* req_wrap = static_cast(req_wrap_); - int err; - err = uv_shutdown(req_wrap->req(), stream(), AfterUvShutdown); - req_wrap->Dispatched(); - return err; + return req_wrap->Dispatch(uv_shutdown, stream(), AfterUvShutdown); } @@ -340,9 +337,14 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap, LibuvWriteWrap* w = static_cast(req_wrap); int r; if (send_handle == nullptr) { - r = uv_write(w->req(), stream(), bufs, count, AfterUvWrite); + r = w->Dispatch(uv_write, stream(), bufs, count, AfterUvWrite); } else { - r = uv_write2(w->req(), stream(), bufs, count, send_handle, AfterUvWrite); + r = w->Dispatch(uv_write2, + stream(), + bufs, + count, + send_handle, + AfterUvWrite); } if (!r) { @@ -356,8 +358,6 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap, } } - w->Dispatched(); - return r; }