Skip to content

Commit 69bf5b7

Browse files
addaleaxBethGriggs
authored andcommitted
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 Backport-PR-URL: #29968 PR-URL: #29912 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 13d8549 commit 69bf5b7

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
@@ -36,7 +36,8 @@ const {
3636
const assert = require('assert');
3737
const {
3838
UV_EADDRINUSE,
39-
UV_EINVAL
39+
UV_EINVAL,
40+
UV_ENOTCONN
4041
} = process.binding('uv');
4142

4243
const { Buffer } = require('buffer');
@@ -357,7 +358,7 @@ Socket.prototype._final = function(cb) {
357358
req.callback = cb;
358359
var err = this._handle.shutdown(req);
359360

360-
if (err === 1) // synchronous finish
361+
if (err === 1 || err === UV_ENOTCONN) // synchronous finish
361362
return afterShutdown.call(req, 0);
362363
else if (err !== 0)
363364
return this.destroy(errnoException(err, 'shutdown'));

0 commit comments

Comments
 (0)