GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — net: refactor onSlaveClose in Server.close · nodejs/node@1bd07ac

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • net.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/net.js‎

Copy file name to clipboardExpand all lines: lib/net.js
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,13 +1495,6 @@ Server.prototype.getConnections = function(cb) {
14951495

14961496

14971497
Server.prototype.close = function(cb) {
1498-
function onSlaveClose() {
1499-
if (--left !== 0) return;
1500-
1501-
self._connections = 0;
1502-
self._emitCloseIfDrained();
1503-
}
1504-
15051498
if (typeof cb === 'function') {
15061499
if (!this._handle) {
15071500
this.once('close', function() {
@@ -1518,8 +1511,13 @@ Server.prototype.close = function(cb) {
15181511
}
15191512

15201513
if (this._usingSlaves) {
1521-
var self = this;
15221514
var left = this._slaves.length;
1515+
const onSlaveClose = () => {
1516+
if (--left !== 0) return;
1517+
1518+
this._connections = 0;
1519+
this._emitCloseIfDrained();
1520+
};
15231521

15241522
// Increment connections to be sure that, even if all sockets will be closed
15251523
// during polling of slaves, `close` event will be emitted only once.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.