Skip to content
Permalink
Browse files

tls: replace var with let

PR-URL: #30308
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
dividead authored and MylesBorins committed Nov 6, 2019
1 parent 8725a5c commit 6fe2c7a1064a661a481ecb109de2b8d78037e421
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/_tls_wrap.js
@@ -129,7 +129,7 @@ function loadSession(hello) {
);
const owner = this[owner_symbol];

var once = false;
let once = false;
function onSession(err, session) {
debug('server resumeSession callback(err %j, sess? %s)', err, !!session);
if (once)
@@ -263,7 +263,7 @@ function onnewsession(sessionId, session) {
if (!owner.server)
return;

var once = false;
let once = false;
const done = () => {
debug('onnewsession done');
if (once)
@@ -345,7 +345,7 @@ function initRead(tlsSocket, socket) {

// Socket already has some buffered data - emulate receiving it
if (socket && socket.readableLength) {
var buf;
let buf;
while ((buf = socket.read()) !== null)
tlsSocket._handle.receive(buf);
}
@@ -389,7 +389,7 @@ function TLSSocket(socket, opts) {
this.authorizationError = null;
this[kRes] = null;

var wrap;
let wrap;
if ((socket instanceof net.Socket && socket._handle) || !socket) {
// 1. connected socket
// 2. no socket, one will be created with net.Socket().connect
@@ -455,7 +455,7 @@ function makeMethodProxy(name) {
return this._parent[name].apply(this._parent, args);
};
}
for (var n = 0; n < proxiedMethods.length; n++) {
for (let n = 0; n < proxiedMethods.length; n++) {
tls_wrap.TLSWrap.prototype[proxiedMethods[n]] =
makeMethodProxy(proxiedMethods[n]);
}
@@ -493,7 +493,7 @@ TLSSocket.prototype.disableRenegotiation = function disableRenegotiation() {
};

TLSSocket.prototype._wrapHandle = function(wrap) {
var handle;
let handle;

if (wrap)
handle = wrap._handle;
@@ -1259,7 +1259,7 @@ Server.prototype.addContext = function(servername, context) {
function SNICallback(servername, callback) {
const contexts = this.server._contexts;

for (var i = 0; i < contexts.length; i++) {
for (let i = 0; i < contexts.length; i++) {
const elem = contexts[i];
if (elem[0].test(servername)) {
callback(null, elem[1]);
@@ -1273,7 +1273,7 @@ function SNICallback(servername, callback) {

// Target API:
//
// var s = tls.connect({port: 8000, host: "google.com"}, function() {
// let s = tls.connect({port: 8000, host: "google.com"}, function() {
// if (!s.authorized) {
// s.destroy();
// return;
@@ -1374,7 +1374,7 @@ let warnOnAllowUnauthorized = true;
// Arguments: [port,] [host,] [options,] [cb]
exports.connect = function connect(...args) {
args = normalizeConnectArgs(args);
var options = args[0];
let options = args[0];
const cb = args[1];
const allowUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0';

0 comments on commit 6fe2c7a

Please sign in to comment.
You can’t perform that action at this time.