Verify validId before reporting a winning reponse to a proposal.

This commit is contained in:
Howard Stearns 2016-02-07 14:57:29 -08:00
parent 1a0017900c
commit 8b27b90566
2 changed files with 5 additions and 2 deletions

View file

@ -1,6 +1,6 @@
(function () {
// See tests/performance/tribbles.js
Script.include("../libraries/virtualBaton.39.js");
Script.include("../libraries/virtualBaton.40.js");
var dimensions, oldColor, entityID,
editRate = 60,
moveRate = 1,

View file

@ -219,7 +219,10 @@ function virtualBatonf(options) {
var response = {proposalNumber: data.number, proposerId: data.proposerId};
if (betterNumber(data, bestProposal)) {
bestProposal = data;
if (accepted.winner) {
// For stability, we don't let any one proposer rule out a disconnnected winner.
// If someone notices that a winner has disconnected (in their recheckWatchdog),
// they call for a new election. To remain chosen, a quorum need to confirm here.
if (accepted.winner && connectionTest(accepted.winner)) {
response.number = accepted.number;
response.winner = accepted.winner;
}