| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e966d1f commit f3f19ee
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -444,9 +444,7 @@ Socket.prototype.destroySoon = function() { | |||
| 444 | 444 | Socket.prototype._destroy = function(exception, cb) { | |
| 445 | 445 | debug('destroy'); | |
| 446 | 446 | ||
| 447 | - var self = this; | ||
| 448 | - | ||
| 449 | - function fireErrorCallbacks() { | ||
| 447 | + function fireErrorCallbacks(self) { | ||
| 450 | 448 | if (cb) cb(exception); | |
| 451 | 449 | if (exception && !self._writableState.errorEmitted) { | |
| 452 | 450 | process.nextTick(emitErrorNT, self, exception); | |
@@ -456,11 +454,11 @@ Socket.prototype._destroy = function(exception, cb) { | |||
| 456 | 454 | ||
| 457 | 455 | if (this.destroyed) { | |
| 458 | 456 | debug('already destroyed, fire error callbacks'); | |
| 459 | - fireErrorCallbacks(); | ||
| 457 | + fireErrorCallbacks(this); | ||
| 460 | 458 | return; | |
| 461 | 459 | } | |
| 462 | 460 | ||
| 463 | - self._connecting = false; | ||
| 461 | + this._connecting = false; | ||
| 464 | 462 | ||
| 465 | 463 | this.readable = this.writable = false; | |
| 466 | 464 | ||
@@ -472,9 +470,9 @@ Socket.prototype._destroy = function(exception, cb) { | |||
| 472 | 470 | if (this !== process.stderr) | |
| 473 | 471 | debug('close handle'); | |
| 474 | 472 | var isException = exception ? true : false; | |
| 475 | - this._handle.close(function() { | ||
| 473 | + this._handle.close(() => { | ||
| 476 | 474 | debug('emit close'); | |
| 477 | - self.emit('close', isException); | ||
| 475 | + this.emit('close', isException); | ||
| 478 | 476 | }); | |
| 479 | 477 | this._handle.onread = noop; | |
| 480 | 478 | this._handle = null; | |
@@ -485,7 +483,7 @@ Socket.prototype._destroy = function(exception, cb) { | |||
| 485 | 483 | // to make it re-entrance safe in case Socket.prototype.destroy() | |
| 486 | 484 | // is called within callbacks | |
| 487 | 485 | this.destroyed = true; | |
| 488 | - fireErrorCallbacks(); | ||
| 486 | + fireErrorCallbacks(this); | ||
| 489 | 487 | ||
| 490 | 488 | if (this._server) { | |
| 491 | 489 | COUNTER_NET_SERVER_CONNECTION_CLOSE(this); | |
@@ -1078,33 +1076,31 @@ function Server(options, connectionListener) { | |||
| 1078 | 1076 | ||
| 1079 | 1077 | EventEmitter.call(this); | |
| 1080 | 1078 | ||
| 1081 | - var self = this; | ||
| 1082 | - | ||
| 1083 | 1079 | if (typeof options === 'function') { | |
| 1084 | 1080 | connectionListener = options; | |
| 1085 | 1081 | options = {}; | |
| 1086 | - self.on('connection', connectionListener); | ||
| 1082 | + this.on('connection', connectionListener); | ||
| 1087 | 1083 | } else { | |
| 1088 | 1084 | options = options || {}; | |
| 1089 | 1085 | ||
| 1090 | 1086 | if (typeof connectionListener === 'function') { | |
| 1091 | - self.on('connection', connectionListener); | ||
| 1087 | + this.on('connection', connectionListener); | ||
| 1092 | 1088 | } | |
| 1093 | 1089 | } | |
| 1094 | 1090 | ||
| 1095 | 1091 | this._connections = 0; | |
| 1096 | 1092 | ||
| 1097 | 1093 | Object.defineProperty(this, 'connections', { | |
| 1098 | - get: internalUtil.deprecate(function() { | ||
| 1094 | + get: internalUtil.deprecate(() => { | ||
| 1099 | 1095 | ||
| 1100 | - if (self._usingSlaves) { | ||
| 1096 | + if (this._usingSlaves) { | ||
| 1101 | 1097 | return null; | |
| 1102 | 1098 | } | |
| 1103 | - return self._connections; | ||
| 1099 | + return this._connections; | ||
| 1104 | 1100 | }, 'Server.connections property is deprecated. ' + | |
| 1105 | 1101 | 'Use Server.getConnections method instead.'), | |
| 1106 | - set: internalUtil.deprecate(function(val) { | ||
| 1107 | - return (self._connections = val); | ||
| 1102 | + set: internalUtil.deprecate((val) => { | ||
| 1103 | + return (this._connections = val); | ||
| 1108 | 1104 | }, 'Server.connections property is deprecated.'), | |
| 1109 | 1105 | configurable: true, enumerable: false | |
| 1110 | 1106 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments