Skip to content

Commit

Permalink
sbft: handle backlog for all messages
Browse files Browse the repository at this point in the history
Change-Id: I8a40d51d70a56ee432d1cecb1d162b5166e1567b
Signed-off-by: Simon Schubert <sis@zurich.ibm.com>
  • Loading branch information
corecode committed Nov 3, 2016
1 parent 0c12e56 commit cc7c8af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions consensus/simplebft/backlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ func (s *SBFT) testBacklog(m *Msg, src uint64) bool {
return true
}

return s.testBacklog2(m, src)
return s.testBacklogMessage(m, src)
}

func (s *SBFT) testBacklog2(m *Msg, src uint64) bool {
func (s *SBFT) testBacklogMessage(m *Msg, src uint64) bool {
record := func(seq *SeqView) bool {
if !s.activeView {
return true
Expand Down Expand Up @@ -80,7 +80,7 @@ func (s *SBFT) processBacklog() {

for len(state.backLog) > 0 {
m, rest := state.backLog[0], state.backLog[1:]
if s.testBacklog2(m, src) {
if s.testBacklogMessage(m, src) {
notReady++
break
}
Expand Down
12 changes: 6 additions & 6 deletions consensus/simplebft/simplebft.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@ func (s *SBFT) Receive(m *Msg, src uint64) {
} else if req := m.GetRequest(); req != nil {
s.handleRequest(req, src)
return
} else if vs := m.GetViewChange(); vs != nil {
s.handleViewChange(vs, src)
return
} else if nv := m.GetNewView(); nv != nil {
s.handleNewView(nv, src)
return
}

if s.testBacklog(m, src) {
Expand All @@ -222,6 +216,12 @@ func (s *SBFT) handleQueueableMessage(m *Msg, src uint64) {
} else if c := m.GetCheckpoint(); c != nil {
s.handleCheckpoint(c, src)
return
} else if vs := m.GetViewChange(); vs != nil {
s.handleViewChange(vs, src)
return
} else if nv := m.GetNewView(); nv != nil {
s.handleNewView(nv, src)
return
}

log.Warningf("received invalid message from %d", src)
Expand Down

0 comments on commit cc7c8af

Please sign in to comment.