Browse Source

blocksync: drop redundant shutdown mechanisms

pull/8136/head
tycho garen 2 years ago
parent
commit
1c59019166
1 changed files with 0 additions and 16 deletions
  1. +0
    -16
      internal/blocksync/pool.go

+ 0
- 16
internal/blocksync/pool.go View File

@ -86,7 +86,6 @@ type BlockPool struct {
requestsCh chan<- BlockRequest
errorsCh chan<- peerError
exitedCh chan struct{}
startHeight int64
lastHundredBlockTimeStamp time.Time
@ -109,7 +108,6 @@ func NewBlockPool(
height: start,
startHeight: start,
numPending: 0,
exitedCh: make(chan struct{}),
requestsCh: requestsCh,
errorsCh: errorsCh,
lastSyncRate: 0,
@ -125,11 +123,6 @@ func (pool *BlockPool) OnStart(ctx context.Context) error {
pool.lastHundredBlockTimeStamp = pool.lastAdvance
go pool.makeRequestersRoutine(ctx)
go func() {
defer close(pool.exitedCh)
pool.Wait()
}()
return nil
}
@ -637,12 +630,6 @@ func (bpr *bpRequester) redo(peerID types.NodeID) {
// Responsible for making more requests as necessary
// Returns only when a block is found (e.g. AddBlock() is called)
func (bpr *bpRequester) requestRoutine(ctx context.Context) {
bprPoolDone := make(chan struct{})
go func() {
defer close(bprPoolDone)
bpr.pool.Wait()
}()
OUTER_LOOP:
for {
// Pick a peer to send request to.
@ -670,9 +657,6 @@ OUTER_LOOP:
select {
case <-ctx.Done():
return
case <-bpr.pool.exitedCh:
bpr.Stop()
return
case peerID := <-bpr.redoCh:
if peerID == bpr.peerID {
bpr.reset()


Loading…
Cancel
Save