From 1ca46ab6f4dec15464984bcd201fd26f8a27b974 Mon Sep 17 00:00:00 2001 From: Marco Levrero Date: Tue, 19 Jun 2018 22:03:33 +0100 Subject: [PATCH] http,tls: name anonymous callbacks This commit is to help in the effort to name all anonymous functions to help when heap debugging. Specifically, this commit fixes some anonymous functions used as listeners in the lib/ folder. PR-URL: https://github.com/nodejs/node/pull/21412 Reviewed-By: Weijia Wang Reviewed-By: Trivikram Kamat Reviewed-By: Benjamin Gruenbaum Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski Reviewed-By: Jon Moss Refs: https://github.com/nodejs/node/issues/8913 --- lib/_http_outgoing.js | 4 ++-- lib/_tls_common.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 913935048680eb..d150a9d93cdf88 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -183,7 +183,7 @@ OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) { } if (!this.socket) { - this.once('socket', function(socket) { + this.once('socket', function socketSetTimeoutOnConnect(socket) { socket.setTimeout(msecs); }); } else { @@ -200,7 +200,7 @@ OutgoingMessage.prototype.destroy = function destroy(error) { if (this.socket) { this.socket.destroy(error); } else { - this.once('socket', function(socket) { + this.once('socket', function socketDestroyOnConnect(socket) { socket.destroy(error); }); } diff --git a/lib/_tls_common.js b/lib/_tls_common.js index d8f6afed0bd8fb..de96fa687dcc02 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -240,7 +240,7 @@ exports.translatePeerCertificate = function translatePeerCertificate(c) { c.infoAccess = Object.create(null); // XXX: More key validation? - info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function(all, key, val) { + info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, (all, key, val) => { if (key in c.infoAccess) c.infoAccess[key].push(val); else