Browse Source

consensus: remove unused closer construct (#7734)

This is clearly a cob-web in the code, and may predict a solution to #7729, though this is difficult to backport because we don't have contexts in 0.35
pull/7738/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
1d3ecf37ee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 20 deletions
  1. +0
    -3
      internal/consensus/peer_state.go
  2. +0
    -17
      internal/consensus/reactor.go

+ 0
- 3
internal/consensus/peer_state.go View File

@ -8,7 +8,6 @@ import (
"time" "time"
cstypes "github.com/tendermint/tendermint/internal/consensus/types" cstypes "github.com/tendermint/tendermint/internal/consensus/types"
tmsync "github.com/tendermint/tendermint/internal/libs/sync"
"github.com/tendermint/tendermint/libs/bits" "github.com/tendermint/tendermint/libs/bits"
"github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/log"
tmtime "github.com/tendermint/tendermint/libs/time" tmtime "github.com/tendermint/tendermint/libs/time"
@ -46,7 +45,6 @@ type PeerState struct {
Stats *peerStateStats `json:"stats"` Stats *peerStateStats `json:"stats"`
broadcastWG sync.WaitGroup broadcastWG sync.WaitGroup
closer *tmsync.Closer
} }
// NewPeerState returns a new PeerState for the given node ID. // NewPeerState returns a new PeerState for the given node ID.
@ -54,7 +52,6 @@ func NewPeerState(logger log.Logger, peerID types.NodeID) *PeerState {
return &PeerState{ return &PeerState{
peerID: peerID, peerID: peerID,
logger: logger, logger: logger,
closer: tmsync.NewCloser(),
PRS: cstypes.PeerRoundState{ PRS: cstypes.PeerRoundState{
Round: -1, Round: -1,
ProposalPOLRound: -1, ProposalPOLRound: -1,


+ 0
- 17
internal/consensus/reactor.go View File

@ -228,7 +228,6 @@ func (r *Reactor) OnStop() {
// This is safe to perform with the lock since none of the peers require the // This is safe to perform with the lock since none of the peers require the
// lock to complete any of the methods that the waitgroup is waiting on. // lock to complete any of the methods that the waitgroup is waiting on.
for _, state := range r.peers { for _, state := range r.peers {
state.closer.Close()
state.broadcastWG.Wait() state.broadcastWG.Wait()
} }
r.mtx.Unlock() r.mtx.Unlock()
@ -507,11 +506,6 @@ OUTER_LOOP:
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return
case <-ps.closer.Done():
// The peer is marked for removal via a PeerUpdate as the doneCh was
// explicitly closed to signal we should exit.
return
default: default:
} }
@ -770,11 +764,6 @@ OUTER_LOOP:
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return
case <-ps.closer.Done():
// The peer is marked for removal via a PeerUpdate as the doneCh was
// explicitly closed to signal we should exit.
return
default: default:
} }
@ -863,10 +852,6 @@ OUTER_LOOP:
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return
case <-ps.closer.Done():
// The peer is marked for removal via a PeerUpdate as the doneCh was
// explicitly closed to signal we should exit.
return
default: default:
} }
@ -1055,8 +1040,6 @@ func (r *Reactor) processPeerUpdate(ctx context.Context, peerUpdate p2p.PeerUpda
ps, ok := r.peers[peerUpdate.NodeID] ps, ok := r.peers[peerUpdate.NodeID]
if ok && ps.IsRunning() { if ok && ps.IsRunning() {
// signal to all spawned goroutines for the peer to gracefully exit // signal to all spawned goroutines for the peer to gracefully exit
ps.closer.Close()
go func() { go func() {
// Wait for all spawned broadcast goroutines to exit before marking the // Wait for all spawned broadcast goroutines to exit before marking the
// peer state as no longer running and removal from the peers map. // peer state as no longer running and removal from the peers map.


Loading…
Cancel
Save