Skip to content

Commit da58301

Browse files
committed
net: treat ENOTCONN at shutdown as success
While it is not entirely clear why this condition is being triggered, it does resolve a reported bug. Fixes: #26315 PR-URL: #29912 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent d9174b4 commit da58301

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/net.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ const {
3939
constassert=require('internal/assert');
4040
const{
4141
UV_EADDRINUSE,
42-
UV_EINVAL
42+
UV_EINVAL,
43+
UV_ENOTCONN
4344
}=internalBinding('uv');
4445

4546
const{ Buffer }=require('buffer');
@@ -403,7 +404,7 @@ Socket.prototype._final = function(cb) {
403404
req.callback=cb;
404405
consterr=this._handle.shutdown(req);
405406

406-
if(err===1)// synchronous finish
407+
if(err===1||err===UV_ENOTCONN)// synchronous finish
407408
returnafterShutdown.call(req,0);
408409
elseif(err!==0)
409410
returnthis.destroy(errnoException(err,'shutdown'));

0 commit comments

Comments
 (0)