diff --git a/lib/democracy.js b/lib/democracy.js index 18abd47..17f05d6 100644 --- a/lib/democracy.js +++ b/lib/democracy.js @@ -318,9 +318,14 @@ class Democracy extends EventEmitter { if (!this._nodes[data.id]) { this.addNodeToList(data); } else { + const revived = this._nodes[data.id].state === 'removed' && data.state !== 'removed'; this._nodes[data.id].last = Date.now(); this._nodes[data.id].state = data.state; this._nodes[data.id].weight = data.weight; + + if (revived) { + this.emit('added', this._nodes[data.id]); + } } // Reset the voters since we've now seen this node again. diff --git a/package.json b/package.json index 70b451c..591bfa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "democracy", - "version": "3.1.1", + "version": "3.1.2", "description": "Node.js unicast discovery, master-slave elections and pub/sub.", "homepage": "https://github.com/goldfire/democracy.js", "keywords": [