Skip to content

Commit e55c5c3

Browse files
cjihrigaddaleax
authored andcommitted
http: reuse noop function in socketOnError()
PR-URL: #25566 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 0c046e8 commit e55c5c3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎lib/_http_server.js‎

Lines changed: 2 additions & 1 deletion
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+
constnoop=()=>{};
502503
constbadRequestResponse=Buffer.from(
503504
`HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}${CRLF}`,'ascii'
504505
);
505506
functionsocketOnError(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)