mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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:
parent
7b64e16916
commit
f037d29abe
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user