Skip to content

Commit

Permalink
Merge "Remove unnessary broadcast target"
Browse files Browse the repository at this point in the history
  • Loading branch information
christo4ferris authored and Gerrit Code Review committed Aug 23, 2016
2 parents 75cde5e + 12ea1ce commit 8e5e8eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion consensus/pbft/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func newBroadcaster(self uint64, N int, f int, c communicator) *broadcaster {

// We do not start the go routines in the above loop to avoid concurrent map read/writes
for i := 0; i < N; i++ {
if uint64(i) == self {
continue
}
go b.drainer(uint64(i))
}

Expand Down Expand Up @@ -108,7 +111,11 @@ func (b *broadcaster) drainerSend(dest uint64, send *sendRequest, successLastTim

func (b *broadcaster) drainer(dest uint64) {
successLastTime := false
destChan := b.msgChans[dest] // Avoid doing the map lookup every send
destChan, exsit := b.msgChans[dest] // Avoid doing the map lookup every send
if !exsit {
logger.Warningf("could not get message channel for replica %d", dest)
return
}

for {
select {
Expand Down

0 comments on commit 8e5e8eb

Please sign in to comment.