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 fa691f7

Browse filesBrowse files
committed
src: only set JSStreamWrap write req after write()
Otherwise `this[kCurrentWriteRequest]` is set to a value even if one of the `write` calls throws. This is needed in order not to break tests in a later commit. PR-URL: #18676 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent efb4646 commit fa691f7
Copy full SHA for fa691f7

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/internal/wrap_js_stream.js‎

Copy file name to clipboardExpand all lines: lib/internal/wrap_js_stream.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ class JSStreamWrap extends Socket {
137137
doWrite(req, bufs) {
138138
assert.strictEqual(this[kCurrentWriteRequest], null);
139139
assert.strictEqual(this[kCurrentShutdownRequest], null);
140-
this[kCurrentWriteRequest] = req;
141140

142141
const handle = this._handle;
143142
const self = this;
@@ -149,6 +148,9 @@ class JSStreamWrap extends Socket {
149148
this.stream.write(bufs[i], done);
150149
this.stream.uncork();
151150

151+
// Only set the request here, because the `write()` calls could throw.
152+
this[kCurrentWriteRequest] = req;
153+
152154
function done(err) {
153155
if (!err && --pending !== 0)
154156
return;

0 commit comments

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