Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2f3a28d

Browse filesBrowse files
maclover7targos
authored andcommitted
src: use available ReqWrap instance for libuv req
Use available `ReqWrap` descendant to make call to libuv -- avoid doing call with the `ReqWrap`'s request member and then calling `Dispatched()` afterwards. PR-URL: #21980 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ce527d9 commit 2f3a28d
Copy full SHA for 2f3a28d

File tree

Expand file treeCollapse file tree

2 files changed

+14
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-11
lines changed
Open diff view settings
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,9 +1552,12 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
15521552
len = StringBytes::Write(env->isolate(), *stack_buffer, len, args[1], enc);
15531553
stack_buffer.SetLengthAndZeroTerminate(len);
15541554
uv_buf_t uvbuf = uv_buf_init(*stack_buffer, len);
1555-
int err = uv_fs_write(env->event_loop(), req_wrap_async->req(),
1556-
fd, &uvbuf, 1, pos, AfterInteger);
1557-
req_wrap_async->Dispatched();
1555+
int err = req_wrap_async->Dispatch(uv_fs_write,
1556+
fd,
1557+
&uvbuf,
1558+
1,
1559+
pos,
1560+
AfterInteger);
15581561
if (err < 0) {
15591562
uv_fs_t* uv_req = req_wrap_async->req();
15601563
uv_req->result = err;
Collapse file

‎src/stream_wrap.cc‎

Copy file name to clipboardExpand all lines: src/stream_wrap.cc
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,7 @@ WriteWrap* LibuvStreamWrap::CreateWriteWrap(Local<Object> object) {
276276

277277
int LibuvStreamWrap::DoShutdown(ShutdownWrap* req_wrap_) {
278278
LibuvShutdownWrap* req_wrap = static_cast<LibuvShutdownWrap*>(req_wrap_);
279-
int err;
280-
err = uv_shutdown(req_wrap->req(), stream(), AfterUvShutdown);
281-
req_wrap->Dispatched();
282-
return err;
279+
return req_wrap->Dispatch(uv_shutdown, stream(), AfterUvShutdown);
283280
}
284281

285282

@@ -340,9 +337,14 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap,
340337
LibuvWriteWrap* w = static_cast<LibuvWriteWrap*>(req_wrap);
341338
int r;
342339
if (send_handle == nullptr) {
343-
r = uv_write(w->req(), stream(), bufs, count, AfterUvWrite);
340+
r = w->Dispatch(uv_write, stream(), bufs, count, AfterUvWrite);
344341
} else {
345-
r = uv_write2(w->req(), stream(), bufs, count, send_handle, AfterUvWrite);
342+
r = w->Dispatch(uv_write2,
343+
stream(),
344+
bufs,
345+
count,
346+
send_handle,
347+
AfterUvWrite);
346348
}
347349

348350
if (!r) {
@@ -356,8 +358,6 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap,
356358
}
357359
}
358360

359-
w->Dispatched();
360-
361361
return r;
362362
}
363363

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.