Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dgram: changed 'var' to 'let' and 'const' #28357

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
dgram: changed 'var' to 'let' and 'const'
mgochoa committed Jun 21, 2019
commit c6896e6d3d165ad12f5c7acea9b21c59ad87069f
22 changes: 11 additions & 11 deletions lib/dgram.js
Original file line number Diff line number Diff line change
@@ -79,15 +79,15 @@ const RECV_BUFFER = true;
const SEND_BUFFER = false;

// Lazily loaded
var cluster = null;
let cluster = null;

const errnoException = errors.errnoException;
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');