From 0af360d3ffc5b17ac294c8827791fbac0a27f4b1 Mon Sep 17 00:00:00 2001 From: ErnestoSalazar Date: Thu, 31 May 2018 10:41:57 -0700 Subject: [PATCH] net: named anonymous functions --- lib/net.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/net.js b/lib/net.js index 6eb6ae818f5ae3..1d25412d41ae8b 100644 --- a/lib/net.js +++ b/lib/net.js @@ -338,7 +338,7 @@ function shutdownSocket(self, callback) { // the user has called .end(), and all the bytes have been // sent out to the other side. -Socket.prototype._final = function(cb) { +Socket.prototype._final = function _final(cb) { // If still connecting - defer handling `_final` until 'connect' will happen if (this.connecting) { debug('_final: not yet connected'); @@ -461,7 +461,7 @@ Socket.prototype.setNoDelay = function(enable) { }; -Socket.prototype.setKeepAlive = function(setting, msecs) { +Socket.prototype.setKeepAlive = function setKeepAlive(setting, msecs) { if (!this._handle) { this.once('connect', () => this.setKeepAlive(setting, msecs)); return this; @@ -474,7 +474,7 @@ Socket.prototype.setKeepAlive = function(setting, msecs) { }; -Socket.prototype.address = function() { +Socket.prototype.address = function address() { return this._getsockname(); }; @@ -513,7 +513,7 @@ Object.defineProperty(Socket.prototype, 'bufferSize', { // Just call handle.readStart until we have enough in the buffer -Socket.prototype._read = function(n) { +Socket.prototype._read = function _read(n) { debug('_read'); if (this.connecting || !this._handle) { @@ -530,7 +530,7 @@ Socket.prototype._read = function(n) { }; -Socket.prototype.end = function(data, encoding, callback) { +Socket.prototype.end = function end(data, encoding, callback) { stream.Duplex.prototype.end.call(this, data, encoding, callback); DTRACE_NET_STREAM_END(this); return this; @@ -560,7 +560,7 @@ function maybeDestroy(socket) { } -Socket.prototype.destroySoon = function() { +Socket.prototype.destroySoon = function destroySoon() { if (this.writable) this.end(); @@ -571,7 +571,7 @@ Socket.prototype.destroySoon = function() { }; -Socket.prototype._destroy = function(exception, cb) { +Socket.prototype._destroy = function _destroy(exception, cb) { debug('destroy'); this.connecting = false; @@ -667,7 +667,7 @@ function onread(nread, buffer) { } -Socket.prototype._getpeername = function() { +Socket.prototype._getpeername = function _getpeername() { if (!this._peername) { if (!this._handle || !this._handle.getpeername) { return {}; @@ -705,7 +705,7 @@ protoGetter('remotePort', function remotePort() { }); -Socket.prototype._getsockname = function() { +Socket.prototype._getsockname = function _getsockname() { if (!this._handle || !this._handle.getsockname) { return {}; } @@ -761,12 +761,12 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) { }; -Socket.prototype._writev = function(chunks, cb) { +Socket.prototype._writev = function _writev(chunks, cb) { this._writeGeneric(true, chunks, '', cb); }; -Socket.prototype._write = function(data, encoding, cb) { +Socket.prototype._write = function _write(data, encoding, cb) { this._writeGeneric(false, data, encoding, cb); }; @@ -932,7 +932,7 @@ function internalConnect( } -Socket.prototype.connect = function(...args) { +Socket.prototype.connect = function connect(...args) { let normalized; // If passed an array, it's treated as an array of arguments that have // already been normalized (so we don't normalize more than once). This has @@ -1093,7 +1093,7 @@ function connectErrorNT(self, err) { } -Socket.prototype.ref = function() { +Socket.prototype.ref = function ref() { if (!this._handle) { this.once('connect', this.ref); return this; @@ -1107,7 +1107,7 @@ Socket.prototype.ref = function() { }; -Socket.prototype.unref = function() { +Socket.prototype.unref = function unref() { if (!this._handle) { this.once('connect', this.unref); return this; @@ -1407,7 +1407,7 @@ function listenInCluster(server, address, port, addressType, } -Server.prototype.listen = function(...args) { +Server.prototype.listen = function listen(...args) { var normalized = normalizeArgs(args); var options = normalized[0]; var cb = normalized[1]; @@ -1515,7 +1515,7 @@ Object.defineProperty(Server.prototype, 'listening', { enumerable: true }); -Server.prototype.address = function() { +Server.prototype.address = function address() { if (this._handle && this._handle.getsockname) { var out = {}; var err = this._handle.getsockname(out); @@ -1564,7 +1564,7 @@ function onconnection(err, clientHandle) { } -Server.prototype.getConnections = function(cb) { +Server.prototype.getConnections = function getConnections(cb) { const self = this; function end(err, connections) { @@ -1602,7 +1602,7 @@ Server.prototype.getConnections = function(cb) { }; -Server.prototype.close = function(cb) { +Server.prototype.close = function close(cb) { if (typeof cb === 'function') { if (!this._handle) { this.once('close', function close() { @@ -1641,7 +1641,7 @@ Server.prototype.close = function(cb) { return this; }; -Server.prototype._emitCloseIfDrained = function() { +Server.prototype._emitCloseIfDrained = function _emitCloseIfDrained() { debug('SERVER _emitCloseIfDrained'); if (this._handle || this._connections) { @@ -1677,7 +1677,7 @@ Server.prototype._setupWorker = function(socketList) { }); }; -Server.prototype.ref = function() { +Server.prototype.ref = function ref() { this._unref = false; if (this._handle) @@ -1686,7 +1686,7 @@ Server.prototype.ref = function() { return this; }; -Server.prototype.unref = function() { +Server.prototype.unref = function unref() { this._unref = true; if (this._handle)