server-graceful-shutdown
Advanced tools
Comparing version 0.1.0 to 0.1.1
12
index.js
@@ -5,9 +5,9 @@ module.exports = enableGracefulShutdown; | ||
server.socketIdleTimeout = socketIdleTimeout || 10000; | ||
var connections = {}; | ||
server.activeConnections = {}; | ||
server.on('connection', function(conn) { | ||
var key = conn.remoteAddress + ':' + conn.remotePort; | ||
connections[key] = conn; | ||
server.activeConnections[key] = conn; | ||
conn.on('close', function() { | ||
delete connections[key]; | ||
delete server.activeConnections[key]; | ||
}); | ||
@@ -18,5 +18,5 @@ }); | ||
server.close(cb); | ||
for (var key in connections) { | ||
connections[key].setTimeout(server.socketIdleTimeout, function() { | ||
connections[key].destroy(); | ||
for (var key in server.activeConnections) { | ||
server.activeConnections[key].setTimeout(server.socketIdleTimeout, function() { | ||
server.activeConnections[key].destroy(); | ||
}); | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "server-graceful-shutdown", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Graceful shutdown for node http(s) servers.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3663