good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
8f873b76
Commit
8f873b76
authored
Apr 18, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
downloader: all handlers check for isBusy
parent
a6c0a75f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth/downloader/downloader.go
+7
-7
7 additions, 7 deletions
eth/downloader/downloader.go
with
7 additions
and
7 deletions
eth/downloader/downloader.go
+
7
−
7
View file @
8f873b76
...
...
@@ -116,7 +116,7 @@ func (d *Downloader) UnregisterPeer(id string) {
// checks fail an error will be returned. This method is synchronous
func
(
d
*
Downloader
)
SynchroniseWithPeer
(
id
string
)
(
types
.
Blocks
,
error
)
{
// Check if we're busy
if
d
.
is
FetchingHashes
()
||
d
.
isDownloadingBlocks
()
||
d
.
isProcessing
()
{
if
d
.
is
Busy
()
{
return
nil
,
errBusy
}
...
...
@@ -213,7 +213,7 @@ func (d *Downloader) selectPeer(p *peer) {
// Make sure it's doing neither. Once done we can restart the
// downloading process if the TD is higher. For now just get on
// with whatever is going on. This prevents unecessary switching.
if
!
(
d
.
is
FetchingHashes
()
||
d
.
isDownloadingBlocks
()
||
d
.
isProcessing
()
)
{
if
!
d
.
is
Busy
(
)
{
// selected peer must be better than our own
// XXX we also check the peer's recent hash to make sure we
// don't have it. Some peers report (i think) incorrect TD.
...
...
@@ -340,10 +340,6 @@ out:
// from the available peers.
if
d
.
queue
.
hashPool
.
Size
()
>
0
{
availablePeers
:=
d
.
peers
.
get
(
idleState
)
if
len
(
availablePeers
)
==
0
{
glog
.
V
(
logger
.
Detail
)
.
Infoln
(
"No peers available out of"
,
len
(
d
.
peers
))
}
for
_
,
peer
:=
range
availablePeers
{
// Get a possible chunk. If nil is returned no chunk
// could be returned due to no hashes available.
...
...
@@ -440,7 +436,7 @@ func (d *Downloader) AddBlock(id string, block *types.Block, td *big.Int) {
d
.
queue
.
addBlock
(
id
,
block
,
td
)
// if neither go ahead to process
if
!
(
d
.
is
FetchingHashes
()
||
d
.
isDownloadingBlocks
()
)
{
if
!
d
.
is
Busy
(
)
{
// Check if the parent of the received block is known.
// If the block is not know, request it otherwise, request.
phash
:=
block
.
ParentHash
()
...
...
@@ -519,3 +515,7 @@ func (d *Downloader) isDownloadingBlocks() bool {
func
(
d
*
Downloader
)
isProcessing
()
bool
{
return
atomic
.
LoadInt32
(
&
d
.
processingBlocks
)
==
1
}
func
(
d
*
Downloader
)
isBusy
()
bool
{
return
d
.
isFetchingHashes
()
||
d
.
isDownloadingBlocks
()
||
d
.
isProcessing
()
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment