Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
addaleax committed Oct 10, 2019
commit 4f135105143525a72859f855199ad88603453e22
5 changes: 3 additions & 2 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const {
const assert = require('internal/assert');
const {
UV_EADDRINUSE,
UV_EINVAL
UV_EINVAL,
UV_ENOTCONN
} = internalBinding('uv');

const { Buffer } = require('buffer');
Expand Down Expand Up @@ -403,7 +404,7 @@ Socket.prototype._final = function(cb) {
req.callback = cb;
const err = this._handle.shutdown(req);

if (err === 1) // synchronous finish
if (err === 1 || err === UV_ENOTCONN) // synchronous finish
return afterShutdown.call(req, 0);
else if (err !== 0)
return this.destroy(errnoException(err, 'shutdown'));
Expand Down