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 7153bec

Browse filesBrowse files
committed
src: always call ReadStop() before Close()
For libuv-backed streams, always explicitly stop reading before closing the handle. PR-URL: #19377 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 61415dc commit 7153bec
Copy full SHA for 7153bec

File tree

Expand file treeCollapse file tree

3 files changed

+9
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+9
-1
lines changed
Open diff view settings
Collapse file

‎src/handle_wrap.h‎

Copy file name to clipboardExpand all lines: src/handle_wrap.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ class HandleWrap : public AsyncWrap {
7070

7171
inline uv_handle_t* GetHandle() const { return handle_; }
7272

73-
void Close(v8::Local<v8::Value> close_callback = v8::Local<v8::Value>());
73+
virtual void Close(
74+
v8::Local<v8::Value> close_callback = v8::Local<v8::Value>());
7475

7576
protected:
7677
HandleWrap(Environment* env,
Collapse file

‎src/stream_wrap.cc‎

Copy file name to clipboardExpand all lines: src/stream_wrap.cc
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ void LibuvStreamWrap::AfterUvWrite(uv_write_t* req, int status) {
373373
req_wrap->Done(status);
374374
}
375375

376+
void LibuvStreamWrap::Close(v8::Local<v8::Value> close_callback) {
377+
ReadStop();
378+
HandleWrap::Close(close_callback);
379+
}
380+
376381
} // namespace node
377382

378383
NODE_BUILTIN_MODULE_CONTEXT_AWARE(stream_wrap,
Collapse file

‎src/stream_wrap.h‎

Copy file name to clipboardExpand all lines: src/stream_wrap.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase {
7676
ShutdownWrap* CreateShutdownWrap(v8::Local<v8::Object> object) override;
7777
WriteWrap* CreateWriteWrap(v8::Local<v8::Object> object) override;
7878

79+
void Close(v8::Local<v8::Value> close_callback) override;
80+
7981
protected:
8082
LibuvStreamWrap(Environment* env,
8183
v8::Local<v8::Object> object,

0 commit comments

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