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 f17987b

Browse filesBrowse files
committed
src: remove HasWriteQueue()
Tests are passing without it, and this otherwise makes the code harder to reason about because the `async` flag on the write request object would not be set even though the callback would still be pending. PR-URL: #18019 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent cf0b95c commit f17987b
Copy full SHA for f17987b

File tree

Expand file treeCollapse file tree

4 files changed

+3
-16
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+3
-16
lines changed
Open diff view settings
Collapse file

‎src/stream_base.cc‎

Copy file name to clipboardExpand all lines: src/stream_base.cc
+3-10Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) {
195195
}
196196

197197
err = DoWrite(req_wrap, buf_list, count, nullptr);
198-
if (HasWriteQueue())
199-
req_wrap_obj->Set(env->async(), True(env->isolate()));
198+
req_wrap_obj->Set(env->async(), True(env->isolate()));
200199

201200
if (err)
202201
req_wrap->Dispose();
@@ -254,8 +253,7 @@ int StreamBase::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
254253
}
255254

256255
err = DoWrite(req_wrap, bufs, count, nullptr);
257-
if (HasWriteQueue())
258-
req_wrap_obj->Set(env->async(), True(env->isolate()));
256+
req_wrap_obj->Set(env->async(), True(env->isolate()));
259257
req_wrap_obj->Set(env->buffer_string(), args[1]);
260258

261259
if (err)
@@ -381,8 +379,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) {
381379
reinterpret_cast<uv_stream_t*>(send_handle));
382380
}
383381

384-
if (HasWriteQueue())
385-
req_wrap_obj->Set(env->async(), True(env->isolate()));
382+
req_wrap_obj->Set(env->async(), True(env->isolate()));
386383

387384
if (err)
388385
req_wrap->Dispose();
@@ -476,10 +473,6 @@ int StreamResource::DoTryWrite(uv_buf_t** bufs, size_t* count) {
476473
return 0;
477474
}
478475

479-
bool StreamResource::HasWriteQueue() {
480-
return true;
481-
}
482-
483476

484477
const char* StreamResource::Error() const {
485478
return nullptr;
Collapse file

‎src/stream_base.h‎

Copy file name to clipboardExpand all lines: src/stream_base.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ class StreamResource {
162162
uv_buf_t* bufs,
163163
size_t count,
164164
uv_stream_t* send_handle) = 0;
165-
virtual bool HasWriteQueue();
166165
virtual const char* Error() const;
167166
virtual void ClearError();
168167

Collapse file

‎src/stream_wrap.cc‎

Copy file name to clipboardExpand all lines: src/stream_wrap.cc
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,6 @@ int LibuvStreamWrap::DoWrite(WriteWrap* w,
380380
}
381381

382382

383-
bool LibuvStreamWrap::HasWriteQueue() {
384-
return stream()->write_queue_size > 0;
385-
}
386-
387383

388384
void LibuvStreamWrap::AfterUvWrite(uv_write_t* req, int status) {
389385
WriteWrap* req_wrap = WriteWrap::from_req(req);
Collapse file

‎src/stream_wrap.h‎

Copy file name to clipboardExpand all lines: src/stream_wrap.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase {
5555
uv_buf_t* bufs,
5656
size_t count,
5757
uv_stream_t* send_handle) override;
58-
bool HasWriteQueue() override;
5958

6059
inline uv_stream_t* stream() const {
6160
return stream_;

0 commit comments

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