Commit f13a4fc1 authored by djq2's avatar djq2
Browse files

moving

parent 53f22ac7
......@@ -238,8 +238,20 @@ func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply
}
} else {
//add else statment later to handle optimization
reply.Success = false
if args.PrevLogIndex >= len(rf.log) {
reply.ConflictIdx = len(rf.log) - 1
reply.ConflictTerm = -1
} else {
wrongTerm := rf.log[args.PrevLogIndex].Term
reply.ConflictTerm = wrongTerm
for i := 0; i < len(rf.log); i++ {
if rf.log[i].Term == reply.ConflictTerm{
reply.ConflictIdx = i
break
}
}
}
}
reply.Term = rf.currentTerm
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment