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 authored and Danielle Adams committed 2021-08-16 16:35:26 -04:00
1 parent 5afdc1f4c0
commit 5f92d2fe6d
1 file changed
+2 -2
+2 -2
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.