mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
fix:commit suggestion
This commit is contained in:
parent
89f5aa6104
commit
98db98fb42
4 changed files with 21 additions and 19 deletions
|
|
@ -1282,10 +1282,10 @@ func (d *Downloader) processHeaders(origin uint64, td, ttd *big.Int, beaconMode
|
|||
var (
|
||||
mode = d.getMode()
|
||||
gotHeaders = false // Wait for batches of headers to process
|
||||
secondTimer = time.NewTimer(time.Second)
|
||||
timer = time.NewTimer(time.Second)
|
||||
)
|
||||
|
||||
defer secondTimer.Stop()
|
||||
defer timer.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
|
|
@ -1407,11 +1407,11 @@ func (d *Downloader) processHeaders(origin uint64, td, ttd *big.Int, beaconMode
|
|||
if mode == FullSync || mode == SnapSync {
|
||||
// If we've reached the allowed number of pending headers, stall a bit
|
||||
for d.queue.PendingBodies() >= maxQueuedHeaders || d.queue.PendingReceipts() >= maxQueuedHeaders {
|
||||
secondTimer.Reset(time.Second)
|
||||
timer.Reset(time.Second)
|
||||
select {
|
||||
case <-d.cancelCh:
|
||||
return errCanceled
|
||||
case <-secondTimer.C:
|
||||
case <-timer.C:
|
||||
}
|
||||
}
|
||||
// Otherwise insert the headers for content retrieval
|
||||
|
|
@ -1578,9 +1578,9 @@ func (d *Downloader) processSnapSyncContent() error {
|
|||
var (
|
||||
oldPivot *fetchResult // Locked in pivot block, might change eventually
|
||||
oldTail []*fetchResult // Downloaded content after the pivot
|
||||
secondTimer = time.NewTimer(time.Second)
|
||||
timer = time.NewTimer(time.Second)
|
||||
)
|
||||
defer secondTimer.Stop()
|
||||
defer timer.Stop()
|
||||
for {
|
||||
// Wait for the next batch of downloaded data to be available. If we have
|
||||
// not yet reached the pivot point, wait blockingly as there's no need to
|
||||
|
|
@ -1663,7 +1663,7 @@ func (d *Downloader) processSnapSyncContent() error {
|
|||
oldPivot = P
|
||||
}
|
||||
// Wait for completion, occasionally checking for pivot staleness
|
||||
secondTimer.Reset(time.Second)
|
||||
timer.Reset(time.Second)
|
||||
select {
|
||||
case <-sync.done:
|
||||
if sync.err != nil {
|
||||
|
|
@ -1674,7 +1674,7 @@ func (d *Downloader) processSnapSyncContent() error {
|
|||
}
|
||||
oldPivot = nil
|
||||
|
||||
case <-secondTimer.C:
|
||||
case <-timer.C:
|
||||
oldTail = afterP
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,6 @@ func (n *ExecNode) Stop() error {
|
|||
go func() {
|
||||
waitErr <- n.Cmd.Wait()
|
||||
}()
|
||||
|
||||
timer := time.NewTimer(5 * time.Second)
|
||||
defer timer.Stop()
|
||||
|
||||
|
|
|
|||
|
|
@ -65,10 +65,13 @@ func startStop(net *Network, quit chan struct{}, nodeCount int) {
|
|||
if err != nil {
|
||||
panic("Could not startup node network for mocker")
|
||||
}
|
||||
tick := time.NewTicker(10 * time.Second)
|
||||
defer tick.Stop()
|
||||
|
||||
timer := time.NewTimer(3 * time.Second)
|
||||
var (
|
||||
tick = time.NewTicker(10 * time.Second)
|
||||
timer = time.NewTimer(3 * time.Second)
|
||||
)
|
||||
|
||||
defer tick.Stop()
|
||||
defer timer.Stop()
|
||||
|
||||
for {
|
||||
|
|
|
|||
|
|
@ -1028,14 +1028,14 @@ func (net *Network) Load(snap *Snapshot) error {
|
|||
}
|
||||
}
|
||||
|
||||
snapshotLoadTimeoutTimer := time.NewTimer(snapshotLoadTimeout)
|
||||
defer snapshotLoadTimeoutTimer.Stop()
|
||||
timeout := time.NewTimer(snapshotLoadTimeout)
|
||||
defer timeout.Stop()
|
||||
|
||||
select {
|
||||
// Wait until all connections from the snapshot are established.
|
||||
case <-allConnected:
|
||||
// Make sure that we do not wait forever.
|
||||
case <-snapshotLoadTimeoutTimer.C:
|
||||
case <-timeout.C:
|
||||
return errors.New("snapshot connections not established")
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue