Skip to content

Commit 1ca46ab

Browse files
mlrvtargos
authored andcommitted
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: #21412 Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Jon Moss <[email protected]> Refs: #8913
1 parent d66e52f commit 1ca46ab

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/_http_outgoing.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
183183
}
184184

185185
if (!this.socket) {
186-
this.once('socket', function(socket) {
186+
this.once('socket', function socketSetTimeoutOnConnect(socket) {
187187
socket.setTimeout(msecs);
188188
});
189189
} else {
@@ -200,7 +200,7 @@ OutgoingMessage.prototype.destroy = function destroy(error) {
200200
if (this.socket) {
201201
this.socket.destroy(error);
202202
} else {
203-
this.once('socket', function(socket) {
203+
this.once('socket', function socketDestroyOnConnect(socket) {
204204
socket.destroy(error);
205205
});
206206
}

lib/_tls_common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ exports.translatePeerCertificate = function translatePeerCertificate(c) {
240240
c.infoAccess = Object.create(null);
241241

242242
// XXX: More key validation?
243-
info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function(all, key, val) {
243+
info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, (all, key, val) => {
244244
if (key in c.infoAccess)
245245
c.infoAccess[key].push(val);
246246
else

0 commit comments

Comments
 (0)