dgram: changed 'var' to 'let' and 'const'
PR-URL: https://github.com/nodejs/node/pull/28357 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
1567461052
commit
e5e96fbc35
22
lib/dgram.js
22
lib/dgram.js
@ -79,7 +79,7 @@ const RECV_BUFFER = true;
|
||||
const SEND_BUFFER = false;
|
||||
|
||||
// Lazily loaded
|
||||
var cluster = null;
|
||||
let cluster = null;
|
||||
|
||||
const errnoException = errors.errnoException;
|
||||
const exceptionWithHostPort = errors.exceptionWithHostPort;
|
||||
@ -87,7 +87,7 @@ const exceptionWithHostPort = errors.exceptionWithHostPort;
|
||||
|
||||
function Socket(type, listener) {
|
||||
EventEmitter.call(this);
|
||||
var lookup;
|
||||
let lookup;
|
||||
let recvBufferSize;
|
||||
let sendBufferSize;
|
||||
|
||||
@ -262,8 +262,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
|
||||
return this;
|
||||
}
|
||||
|
||||
var address;
|
||||
var exclusive;
|
||||
let address;
|
||||
let exclusive;
|
||||
|
||||
if (port !== null && typeof port === 'object') {
|
||||
address = port.address || '';
|
||||
@ -293,7 +293,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
|
||||
if (!cluster)
|
||||
cluster = require('cluster');
|
||||
|
||||
var flags = 0;
|
||||
let flags = 0;
|
||||
if (state.reuseAddr)
|
||||
flags |= UV_UDP_REUSEADDR;
|
||||
if (state.ipv6Only)
|
||||
@ -318,7 +318,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
|
||||
|
||||
const err = state.handle.bind(ip, port || 0, flags);
|
||||
if (err) {
|
||||
var ex = exceptionWithHostPort(err, 'bind', ip, port);
|
||||
const ex = exceptionWithHostPort(err, 'bind', ip, port);
|
||||
this.emit('error', ex);
|
||||
state.bindState = BIND_STATE_UNBOUND;
|
||||
// Todo: close?
|
||||
@ -467,8 +467,8 @@ function sliceBuffer(buffer, offset, length) {
|
||||
function fixBufferList(list) {
|
||||
const newlist = new Array(list.length);
|
||||
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
var buf = list[i];
|
||||
for (let i = 0, l = list.length; i < l; i++) {
|
||||
const buf = list[i];
|
||||
if (typeof buf === 'string')
|
||||
newlist[i] = Buffer.from(buf);
|
||||
else if (!isUint8Array(buf))
|
||||
@ -514,7 +514,7 @@ function clearQueue() {
|
||||
state.queue = undefined;
|
||||
|
||||
// Flush the send queue.
|
||||
for (var i = 0; i < queue.length; i++)
|
||||
for (let i = 0; i < queue.length; i++)
|
||||
queue[i]();
|
||||
}
|
||||
|
||||
@ -732,8 +732,8 @@ Socket.prototype.remoteAddress = function() {
|
||||
if (state.connectState !== CONNECT_STATE_CONNECTED)
|
||||
throw new ERR_SOCKET_DGRAM_NOT_CONNECTED();
|
||||
|
||||
var out = {};
|
||||
var err = state.handle.getpeername(out);
|
||||
const out = {};
|
||||
const err = state.handle.getpeername(out);
|
||||
if (err)
|
||||
throw errnoException(err, 'getpeername');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user