net: name anonymous functions
the changes are related https://github.com/nodejs/node/issues/8913 regarding the naming of just the inline anonymous functions that are not assigned to a variable PR-URL: https://github.com/nodejs/node/pull/9357 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
parent
7d18a4d9cf
commit
d1785d9c8b
10
lib/net.js
10
lib/net.js
@ -269,7 +269,7 @@ function onSocketEnd() {
|
|||||||
this.readable = false;
|
this.readable = false;
|
||||||
maybeDestroy(this);
|
maybeDestroy(this);
|
||||||
} else {
|
} else {
|
||||||
this.once('end', function() {
|
this.once('end', function end() {
|
||||||
this.readable = false;
|
this.readable = false;
|
||||||
maybeDestroy(this);
|
maybeDestroy(this);
|
||||||
});
|
});
|
||||||
@ -669,7 +669,7 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
|
|||||||
if (this.connecting) {
|
if (this.connecting) {
|
||||||
this._pendingData = data;
|
this._pendingData = data;
|
||||||
this._pendingEncoding = encoding;
|
this._pendingEncoding = encoding;
|
||||||
this.once('connect', function() {
|
this.once('connect', function connect() {
|
||||||
this._writeGeneric(writev, data, encoding, cb);
|
this._writeGeneric(writev, data, encoding, cb);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -991,7 +991,7 @@ function lookupAndConnect(self, options) {
|
|||||||
debug('connect: dns options', dnsopts);
|
debug('connect: dns options', dnsopts);
|
||||||
self._host = host;
|
self._host = host;
|
||||||
var lookup = options.lookup || dns.lookup;
|
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);
|
self.emit('lookup', err, ip, addressType, host);
|
||||||
|
|
||||||
// It's possible we were destroyed while looking this up.
|
// 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) {
|
function lookupAndListen(self, port, address, backlog, exclusive) {
|
||||||
require('dns').lookup(address, function(err, ip, addressType) {
|
require('dns').lookup(address, function doListening(err, ip, addressType) {
|
||||||
if (err) {
|
if (err) {
|
||||||
self.emit('error', err);
|
self.emit('error', err);
|
||||||
} else {
|
} else {
|
||||||
@ -1494,7 +1494,7 @@ Server.prototype.close = function(cb) {
|
|||||||
|
|
||||||
if (typeof cb === 'function') {
|
if (typeof cb === 'function') {
|
||||||
if (!this._handle) {
|
if (!this._handle) {
|
||||||
this.once('close', function() {
|
this.once('close', function close() {
|
||||||
cb(new Error('Not running'));
|
cb(new Error('Not running'));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user