mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Try to ensure TCP node closes server connections on redeploy
(to clean up properly - especially in case of port changes) Closes Issue #454
This commit is contained in:
parent
d9363f4974
commit
0bb78ae491
@ -182,8 +182,11 @@ module.exports = function(RED) {
|
|||||||
node.error('unable to listen on port '+node.port+' : '+err);
|
node.error('unable to listen on port '+node.port+' : '+err);
|
||||||
} else {
|
} else {
|
||||||
node.log('listening on port '+node.port);
|
node.log('listening on port '+node.port);
|
||||||
|
|
||||||
node.on('close', function() {
|
node.on('close', function() {
|
||||||
|
for (var c in connectionPool) {
|
||||||
|
connectionPool[c].end();
|
||||||
|
connectionPool[c].unref();
|
||||||
|
}
|
||||||
node.closing = true;
|
node.closing = true;
|
||||||
server.close();
|
server.close();
|
||||||
node.log('stopped listening on port '+node.port);
|
node.log('stopped listening on port '+node.port);
|
||||||
@ -334,6 +337,10 @@ module.exports = function(RED) {
|
|||||||
} else {
|
} else {
|
||||||
node.log('listening on port '+node.port);
|
node.log('listening on port '+node.port);
|
||||||
node.on('close', function() {
|
node.on('close', function() {
|
||||||
|
for (var c in connectedSockets) {
|
||||||
|
connectedSockets[c].end();
|
||||||
|
connectedSockets[c].unref();
|
||||||
|
}
|
||||||
server.close();
|
server.close();
|
||||||
node.log('stopped listening on port '+node.port);
|
node.log('stopped listening on port '+node.port);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user