Skip to content

Commit a122ba5

Browse files
addaleaxtargos
authored andcommitted
src: simplify LibuvStreamWrap::DoWrite
PR-URL: #24588 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent b554ff7 commit a122ba5

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/stream_wrap.cc

+6-19
Original file line numberDiff line numberDiff line change
@@ -359,25 +359,12 @@ int LibuvStreamWrap::DoWrite(WriteWrap* req_wrap,
359359
size_t count,
360360
uv_stream_t* send_handle) {
361361
LibuvWriteWrap* w = static_cast<LibuvWriteWrap*>(req_wrap);
362-
int r;
363-
if (send_handle == nullptr) {
364-
r = w->Dispatch(uv_write, stream(), bufs, count, AfterUvWrite);
365-
} else {
366-
r = w->Dispatch(uv_write2,
367-
stream(),
368-
bufs,
369-
count,
370-
send_handle,
371-
AfterUvWrite);
372-
}
373-
374-
if (!r) {
375-
size_t bytes = 0;
376-
for (size_t i = 0; i < count; i++)
377-
bytes += bufs[i].len;
378-
}
379-
380-
return r;
362+
return w->Dispatch(uv_write2,
363+
stream(),
364+
bufs,
365+
count,
366+
send_handle,
367+
AfterUvWrite);
381368
}
382369

383370

0 commit comments

Comments
 (0)