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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent d9174b4 commit da58301

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/net.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ const {
3939
const assert = 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
const err = this._handle.shutdown(req);
405406

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

0 commit comments

Comments
 (0)