|
@ -371,19 +371,21 @@ func (conR *ConsensusReactor) startBroadcastRoutine() error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
go func() { |
|
|
go func() { |
|
|
|
|
|
var data interface{} |
|
|
|
|
|
var ok bool |
|
|
for { |
|
|
for { |
|
|
select { |
|
|
select { |
|
|
case data, ok := <-stepsCh: |
|
|
|
|
|
|
|
|
case data, ok = <-stepsCh: |
|
|
if ok { // a receive from a closed channel returns the zero value immediately
|
|
|
if ok { // a receive from a closed channel returns the zero value immediately
|
|
|
edrs := data.(types.TMEventData).Unwrap().(types.EventDataRoundState) |
|
|
edrs := data.(types.TMEventData).Unwrap().(types.EventDataRoundState) |
|
|
conR.broadcastNewRoundStep(edrs.RoundState.(*cstypes.RoundState)) |
|
|
conR.broadcastNewRoundStep(edrs.RoundState.(*cstypes.RoundState)) |
|
|
} |
|
|
} |
|
|
case data, ok := <-votesCh: |
|
|
|
|
|
|
|
|
case data, ok = <-votesCh: |
|
|
if ok { |
|
|
if ok { |
|
|
edv := data.(types.TMEventData).Unwrap().(types.EventDataVote) |
|
|
edv := data.(types.TMEventData).Unwrap().(types.EventDataVote) |
|
|
conR.broadcastHasVoteMessage(edv.Vote) |
|
|
conR.broadcastHasVoteMessage(edv.Vote) |
|
|
} |
|
|
} |
|
|
case data, ok := <-heartbeatsCh: |
|
|
|
|
|
|
|
|
case data, ok = <-heartbeatsCh: |
|
|
if ok { |
|
|
if ok { |
|
|
edph := data.(types.TMEventData).Unwrap().(types.EventDataProposalHeartbeat) |
|
|
edph := data.(types.TMEventData).Unwrap().(types.EventDataProposalHeartbeat) |
|
|
conR.broadcastProposalHeartbeatMessage(edph) |
|
|
conR.broadcastProposalHeartbeatMessage(edph) |
|
@ -392,6 +394,10 @@ func (conR *ConsensusReactor) startBroadcastRoutine() error { |
|
|
conR.eventBus.UnsubscribeAll(ctx, subscriber) |
|
|
conR.eventBus.UnsubscribeAll(ctx, subscriber) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if !ok { |
|
|
|
|
|
conR.eventBus.UnsubscribeAll(ctx, subscriber) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|