Skip to content

Commit 33a9d17

Browse files
cjihrigMylesBorins
authored andcommitted
http: reuse noop function in socketOnError()
PR-URL: #25566 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 13205d5 commit 33a9d17

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/_http_server.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,15 @@ function onParserExecute(server, socket, parser, state, ret) {
499499
onParserExecuteCommon(server, socket, parser, state, ret, undefined);
500500
}
501501

502+
const noop = () => {};
502503
const badRequestResponse = Buffer.from(
503504
`HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}` +
504505
`Connection: close${CRLF}${CRLF}`, 'ascii'
505506
);
506507
function socketOnError(e) {
507508
// Ignore further errors
508509
this.removeListener('error', socketOnError);
509-
this.on('error', () => {});
510+
this.on('error', noop);
510511

511512
if (!this.server.emit('clientError', e, this)) {
512513
if (this.writable) {

0 commit comments

Comments
 (0)