@@ -31,7 +31,6 @@ public class FastByzantineReplica extends LeaderBasedProtocolReplica {
31
31
32
32
// The number of replicas in the system with each role.
33
33
private final int p , a , l , f ;
34
- // The message round number.
35
34
private long viewNumber ;
36
35
private long proposalNumber ;
37
36
// The value that the leader replica is proposing - changes each round, depending on the client request.
@@ -386,7 +385,11 @@ private void handleAcceptMessage(String sender, AcceptMessage acceptMessage) {
386
385
moveToNextProposal ();
387
386
}
388
387
389
- log .info ("Learner " + getId () + " received ACCEPT from " + sender + " and proposal number " + proposalNumber );
388
+ log .info ("Learner " + getId () +
389
+ " received ACCEPT from " + sender +
390
+ " and proposal number " + sequenceNumber
391
+ + " with value " + new String (acceptMessage .getValueAndProposalNumber ().getValue ()));
392
+
390
393
int acceptedThreshold = (int ) Math .ceil ((a + (3 * f ) + 1 ) / 2.0 );
391
394
boolean isAccepted = messageLog .onAccept (sender , acceptMessage , acceptedThreshold );
392
395
operation = acceptMessage .getValueAndProposalNumber ().getValue ();
@@ -443,9 +446,10 @@ private void handleLearnMessageProposer(String sender, LearnMessage learnMessage
443
446
isSatisfied = true ;
444
447
}
445
448
449
+ // Leader is ready to move to the next request.
446
450
// Leader is ready to move to the next request.
447
451
if (isLeader () && !requests .isEmpty ()
448
- && messageLog .getProposersWithLearnedValue ().size () >= p ) {
452
+ && messageLog .getProposersWithLearnedValue ().size () >= l ) {
449
453
Serializable request = requests .poll ();
450
454
this .proposalNumber ++;
451
455
log .info ("Increasing proposal number: " + this .proposalNumber );
@@ -499,9 +503,9 @@ private void handleLearnMessageLearner(String sender, LearnMessage learnMessage)
499
503
500
504
log .info ("Learner " + getId () + " sending reply to client..." );
501
505
this .sendReplyToClient (clientId , learnMessage .getValueAndProposalNumber ().getValue ());
502
-
503
506
}
504
507
508
+ multicastMessage (new LearnMessage (learnMessage .getValueAndProposalNumber ()), this .proposerNodeIds );
505
509
if (this .learnerTimeoutId != -1 ) this .clearTimeout (this .learnerTimeoutId );
506
510
} else {
507
511
log .info ("Learner " + getId () + " has not learned the value yet" );
0 commit comments