src: simplify LibuvStreamWrap::DoWrite

PR-URL: https://github.com/nodejs/node/pull/24588
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Anna Henningsen authored and Daniel Bevenius committed 2018-11-29 05:43:53 +01:00
1 parent 1dfa1a2acb
commit 5e2ecd40bc
1 file changed
+6 -19
+6 -19
View File
@@ -359,25 +359,12 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap,
size_t count,
uv_stream_t* send_handle) {
LibuvWriteWrap* w = static_cast<LibuvWriteWrap*>(req_wrap);
int r;
if (send_handle == nullptr) {
r = w->Dispatch(uv_write, stream(), bufs, count, AfterUvWrite);
} else {
r = w->Dispatch(uv_write2,
stream(),
bufs,
count,
send_handle,
AfterUvWrite);
}
if (!r) {
size_t bytes = 0;
for (size_t i = 0; i < count; i++)
bytes += bufs[i].len;
}
return r;
return w->Dispatch(uv_write2,
stream(),
bufs,
count,
send_handle,
AfterUvWrite);
}