Skip to content

Commit e6699c6

Browse files
committed
net: replace destroySoon with socket.end()
As per @ronag suggestion, destroySoon is considered obsolete, all of its functionnality having been implemented by Writeable.end() Refs: #36205
1 parent dd2e3ed commit e6699c6

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

lib/_http_client.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,7 @@ function responseOnEnd() {
709709

710710
if (!req.shouldKeepAlive) {
711711
if (socket.writable) {
712-
debug('AGENT socket.destroySoon()');
713-
if (typeof socket.destroySoon === 'function')
714-
socket.destroySoon();
715-
else
716-
socket.end();
712+
socket.end();
717713
}
718714
assert(!socket.writable);
719715
} else if (req.finished && !this.aborted) {

lib/_http_server.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,11 +814,7 @@ function resOnFinish(req, res, socket, state, server) {
814814
process.nextTick(emitCloseNT, res);
815815

816816
if (res._last) {
817-
if (typeof socket.destroySoon === 'function') {
818-
socket.destroySoon();
819-
} else {
820-
socket.end();
821-
}
817+
socket.end();
822818
} else if (state.outgoing.length === 0) {
823819
if (server.keepAliveTimeout && typeof socket.setTimeout === 'function') {
824820
socket.setTimeout(server.keepAliveTimeout);

0 commit comments

Comments
 (0)