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 <starkwang@126.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Refs: https://github.com/nodejs/node/issues/8913
This commit is contained in:
Marco Levrero 2018-06-19 22:03:33 +01:00 коммит произвёл Michaël Zasso
Родитель d66e52fb8e
Коммит 1ca46ab6f4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 770F7A9A5AE15600
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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);
});
}

Просмотреть файл

@ -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