|
|
@ -360,6 +360,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
|
|
|
|
internal: {
|
|
|
|
internal: {
|
|
|
|
initialized: false,
|
|
|
|
initialized: false,
|
|
|
|
sinceLastCheckpoint: 0,
|
|
|
|
sinceLastCheckpoint: 0,
|
|
|
|
|
|
|
|
lastCheckpointHash: -1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var roster = {};
|
|
|
|
var roster = {};
|
|
|
@ -395,6 +396,10 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
|
|
|
|
return Util.clone(ref.state);
|
|
|
|
return Util.clone(ref.state);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
roster.getLastCheckpointHash = function () {
|
|
|
|
|
|
|
|
return ref.internal.lastCheckpointHash || -1;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var clearPendingCheckpoints = function () {
|
|
|
|
var clearPendingCheckpoints = function () {
|
|
|
|
// clear any pending checkpoints you might have...
|
|
|
|
// clear any pending checkpoints you might have...
|
|
|
|
if (ref.internal.pendingCheckpointId) {
|
|
|
|
if (ref.internal.pendingCheckpointId) {
|
|
|
@ -481,6 +486,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
|
|
|
|
events.checkpoint.fire(hash);
|
|
|
|
events.checkpoint.fire(hash);
|
|
|
|
// reset the counter for messages since the last checkpoint
|
|
|
|
// reset the counter for messages since the last checkpoint
|
|
|
|
ref.internal.sinceLastCheckpoint = 0;
|
|
|
|
ref.internal.sinceLastCheckpoint = 0;
|
|
|
|
|
|
|
|
ref.internal.lastCheckpointHash = hash;
|
|
|
|
} else if (changed) {
|
|
|
|
} else if (changed) {
|
|
|
|
events.change.fire();
|
|
|
|
events.change.fire();
|
|
|
|
}
|
|
|
|
}
|
|
|
|