Skip to content

Commit

Permalink
dgram: use simplified validator
Browse files Browse the repository at this point in the history
The `dgram` lib module should use the simplified `validatePort()`
validator.

PR-URL: #39753
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
  • Loading branch information
VoltrexKeyva authored and danielleadams committed Aug 16, 2021
1 parent 5afdc1f commit 5f92d2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
};

Socket.prototype.connect = function(port, address, callback) {
port = validatePort(port, 'Port', { allowZero: false });
port = validatePort(port, 'Port', false);
if (typeof address === 'function') {
callback = address;
address = '';
Expand Down Expand Up @@ -626,7 +626,7 @@ Socket.prototype.send = function(buffer,
}

if (!connected)
port = validatePort(port, 'Port', { allowZero: false });
port = validatePort(port, 'Port', false);

// Normalize callback so it's either a function or undefined but not anything
// else.
Expand Down

0 comments on commit 5f92d2f

Please sign in to comment.