Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Fixed bug with multiClient option, and fixed the test that was writte…
Browse files Browse the repository at this point in the history
…n incorrectly that would have caught the bug to begin with.
  • Loading branch information
stephen-palmer committed May 17, 2018
1 parent cb93af7 commit 6ee0d83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/cache/reliability_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class ReliabilityManager {
const entry = this.getEntry(params.guidStr, params.hashStr, true);
if(!entry.versionHash) {
entry.versionHash = params.versionHashStr;
entry.clientId = params.clientId;
}

if(entry.state !== ReliabilityManager.reliabilityStates.Pending) {
Expand Down
5 changes: 4 additions & 1 deletion test/reliability_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ describe("ReliabilityManager", () => {
const myRm = new ReliabilityManager(db, tmp.tmpNameSync(), { reliabilityThreshold: 2, multiClient: true });
const guid = randomBuffer(consts.GUID_SIZE);
const hash = randomBuffer(consts.HASH_SIZE);
await myRm.processTransaction(new StablePutTransaction(guid, hash));

const trx = new StablePutTransaction(guid, hash);
trx.clientAddress = "A";
Expand All @@ -162,6 +161,10 @@ describe("ReliabilityManager", () => {
const entry = rm.getEntry(helpers.GUIDBufferToString(trx.guid), trx.hash.toString('hex'));
assert.equal(entry.state, ReliabilityManager.reliabilityStates.Pending);

trx.clientAddress = "A";
await myRm.processTransaction(trx);
assert.equal(entry.state, ReliabilityManager.reliabilityStates.Pending);

trx.clientAddress = "B";
await myRm.processTransaction(trx);
assert.equal(entry.state, ReliabilityManager.reliabilityStates.ReliableNew);
Expand Down

0 comments on commit 6ee0d83

Please sign in to comment.