Skip to content

Commit

Permalink
http: reuse noop function in socketOnError()
Browse files Browse the repository at this point in the history
PR-URL: #25566
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
cjihrig committed Jan 20, 2019
1 parent 17c6b1d commit 5571c0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,14 @@ function onParserExecute(server, socket, parser, state, ret) {
onParserExecuteCommon(server, socket, parser, state, ret, undefined);
}

const noop = () => {};
const badRequestResponse = Buffer.from(
`HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}${CRLF}`, 'ascii'
);
function socketOnError(e) {
// Ignore further errors
this.removeListener('error', socketOnError);
this.on('error', () => {});
this.on('error', noop);

if (!this.server.emit('clientError', e, this)) {
if (this.writable) {
Expand Down

0 comments on commit 5571c0d

Please sign in to comment.