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 jasnell committed Aug 15, 2021
1 parent 7b64e16 commit f037d29
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 f037d29

Please sign in to comment.