dgram: use simplified validator

The `dgram` lib module should use the simplified `validatePort()`
validator.

PR-URL: https://github.com/nodejs/node/pull/39753
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
This commit is contained in:
Voltrex 2021-08-13 03:20:51 +04:30 committed by James M Snell
parent 7b64e16916
commit f037d29abe
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC

View File

@ -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 = '';
@ -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.