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 f54659c

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
net: simplify net.Socket#end()
`writable` is already set by the streams side, and there is a handler waiting for the writable side to finish which already takes care of the other cleanup code that was previously there; both of these things can therefore be removed. PR-URL: #18708 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 47dfe29 commit f54659c
Copy full SHA for f54659c

File tree

Expand file treeCollapse file tree

1 file changed

+2
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-10
lines changed
Open diff view settings
Collapse file

‎lib/net.js‎

Copy file name to clipboardExpand all lines: lib/net.js
+2-10Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -496,18 +496,10 @@ Socket.prototype._read = function(n) {
496496
};
497497

498498

499-
Socket.prototype.end = function(data, encoding) {
500-
stream.Duplex.prototype.end.call(this, data, encoding);
501-
this.writable = false;
499+
Socket.prototype.end = function(data, encoding, callback) {
500+
stream.Duplex.prototype.end.call(this, data, encoding, callback);
502501
DTRACE_NET_STREAM_END(this);
503502
LTTNG_NET_STREAM_END(this);
504-
505-
// just in case we're waiting for an EOF.
506-
if (this.readable && !this._readableState.endEmitted)
507-
this.read(0);
508-
else
509-
maybeDestroy(this);
510-
511503
return this;
512504
};
513505

0 commit comments

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