Skip to content

Commit e55c5c3

Browse files
cjihrigaddaleax
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 0c046e8 commit e55c5c3

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,13 +499,14 @@ 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}${CRLF}`, 'ascii'
504505
);
505506
function socketOnError(e) {
506507
// Ignore further errors
507508
this.removeListener('error', socketOnError);
508-
this.on('error', () => {});
509+
this.on('error', noop);
509510

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

0 commit comments

Comments
 (0)