From 2321c4c2e49bceace34a3baa6fdb59cab2f3fb4d Mon Sep 17 00:00:00 2001 From: Pedro Victor Date: Sat, 29 Oct 2016 13:39:53 -0200 Subject: [PATCH 1/2] net: name anonymous functions in net module the changes are related to Ref: #8913 regarding the naming of just the inline anonymous functions that are not assigned to a variable --- lib/net.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/net.js b/lib/net.js index 628908614fbd61..b25168a512c492 100644 --- a/lib/net.js +++ b/lib/net.js @@ -269,7 +269,7 @@ function onSocketEnd() { this.readable = false; maybeDestroy(this); } else { - this.once('end', function() { + this.once('end', function end() { this.readable = false; maybeDestroy(this); }); @@ -669,7 +669,7 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) { if (this.connecting) { this._pendingData = data; this._pendingEncoding = encoding; - this.once('connect', function() { + this.once('connect', function connect() { this._writeGeneric(writev, data, encoding, cb); }); return; @@ -991,7 +991,7 @@ function lookupAndConnect(self, options) { debug('connect: dns options', dnsopts); self._host = host; var lookup = options.lookup || dns.lookup; - lookup(host, dnsopts, function(err, ip, addressType) { + lookup(host, dnsopts, function emitLookup(err, ip, addressType) { self.emit('lookup', err, ip, addressType, host); // It's possible we were destroyed while looking this up. @@ -1389,7 +1389,7 @@ Server.prototype.listen = function() { }; function lookupAndListen(self, port, address, backlog, exclusive) { - require('dns').lookup(address, function(err, ip, addressType) { + require('dns').lookup(address, function emitLookup(err, ip, addressType) { if (err) { self.emit('error', err); } else { @@ -1494,7 +1494,7 @@ Server.prototype.close = function(cb) { if (typeof cb === 'function') { if (!this._handle) { - this.once('close', function() { + this.once('close', function close() { cb(new Error('Not running')); }); } else { From 6ce4862ca1cb500abd6b2ec54ae8f5e1344cad61 Mon Sep 17 00:00:00 2001 From: Pedro Victor Date: Sat, 29 Oct 2016 13:50:25 -0200 Subject: [PATCH 2/2] net: name anonymous functions in net module changing the name proposed to the anonymous function as stated on https://github.com/nodejs/node/pull/9357#discussion_r86013193 --- lib/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index b25168a512c492..ce60d2f3521317 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1389,7 +1389,7 @@ Server.prototype.listen = function() { }; function lookupAndListen(self, port, address, backlog, exclusive) { - require('dns').lookup(address, function emitLookup(err, ip, addressType) { + require('dns').lookup(address, function doListening(err, ip, addressType) { if (err) { self.emit('error', err); } else {