From 607ee37a5da611c805bda3217c7f8c7ed49e9227 Mon Sep 17 00:00:00 2001 From: Marco Levrero Date: Tue, 19 Jun 2018 22:03:33 +0100 Subject: [PATCH] lib: 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. 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..c9ff30ce958140 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 socketOnceCallback(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 socketOnceCallback(socket) { socket.destroy(error); }); } diff --git a/lib/_tls_common.js b/lib/_tls_common.js index d8f6afed0bd8fb..127ecb0fc9a168 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, function replacerCallback(all, key, val) { if (key in c.infoAccess) c.infoAccess[key].push(val); else