Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 36635 #37964

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,12 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) {
this.emit('aborted');
}

// If aborted destroy socket.
if (this.socket && this.aborted) {
// If aborted and the underlying socket is not already destroyed,
// destroy it.
// We have to check if the socket is already destroyed because finished
// does not call the callback when this methdod is invoked from `_http_client`
// in `test/parallel/test-http-client-spurious-aborted.js`
if (this.socket && !this.socket.destroyed && this.aborted) {
this.socket.destroy(err);
const cleanup = finished(this.socket, (e) => {
cleanup();
Expand Down
10 changes: 1 addition & 9 deletions lib/internal/streams/end-of-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ const {
validateObject,
} = require('internal/validators');

function isSocket(stream) {
return (
typeof stream.connect === 'function' &&
typeof stream.setNoDelay === 'function' &&
typeof stream.setKeepAlive === 'function'
);
}

function isRequest(stream) {
return stream.setHeader && typeof stream.abort === 'function';
}
Expand Down Expand Up @@ -105,7 +97,7 @@ function eos(stream, options, callback) {
let willEmitClose = isServerResponse(stream) || (
state &&
state.autoDestroy &&
(state.emitClose || isSocket(stream)) &&
state.emitClose &&
state.closed === false &&
isReadable(stream) === readable &&
isWritable(stream) === writable
Expand Down
12 changes: 0 additions & 12 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,6 @@ Socket.prototype._destroy = function(exception, cb) {

this._handle.close(() => {
debug('emit close');
if (this._writableState) {
this._writableState.closed = true;
}
if (this._readableState) {
this._readableState.closed = true;
}
this.emit('close', isException);
});
this._handle.onread = noop;
Expand Down Expand Up @@ -1655,12 +1649,6 @@ Server.prototype._emitCloseIfDrained = function() {

function emitCloseNT(self) {
debug('SERVER: emit close');
if (self._writableState) {
self._writableState.closed = true;
}
if (self._readableState) {
self._readableState.closed = true;
}
self.emit('close');
}

Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-http-many-ended-pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');

// No warnings should happen!
const trace = console.trace;
Expand Down Expand Up @@ -59,3 +59,5 @@ server.listen(0, function() {
client.end();
client.pipe(process.stdout);
});

process.on('warning', common.mustNotCall());
25 changes: 0 additions & 25 deletions test/parallel/test-net-finished.js

This file was deleted.