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
6d497f61
Commit
6d497f61
authored
Jun 2, 2015
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
eth/downloader: don't block hash deliveries while pulling blocks
parent
9da0232e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth/downloader/downloader.go
+14
-17
14 additions, 17 deletions
eth/downloader/downloader.go
with
14 additions
and
17 deletions
eth/downloader/downloader.go
+
14
−
17
View file @
6d497f61
...
...
@@ -418,6 +418,9 @@ out:
case
<-
d
.
cancelCh
:
return
errCancelBlockFetch
case
<-
d
.
hashCh
:
// Out of bounds hashes received, ignore them
case
blockPack
:=
<-
d
.
blockCh
:
// Short circuit if it's a stale cross check
if
len
(
blockPack
.
blocks
)
==
1
{
...
...
@@ -472,30 +475,21 @@ out:
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"%s: delivery partially failed: %v"
,
peer
,
err
)
}
}
case
<-
ticker
.
C
:
//
Check for bad peers. Bad peers may indicate a peer not responding
// to a `getBlocks` message. A timeout of 5 seconds is set. Peers
// that badly or poorly behave are removed from the peer set (not banned).
// Bad peers are excluded from the available peer set and therefor won't be
//
reused. XXX We could re-introduce peers after X time.
//
Short circuit if we lost all our peers
if
d
.
peers
.
Len
()
==
0
{
return
errNoPeers
}
//
Check for block request timeouts and demote the responsible peers
badPeers
:=
d
.
queue
.
Expire
(
blockHardTTL
)
for
_
,
pid
:=
range
badPeers
{
// XXX We could make use of a reputation system here ranking peers
// in their performance
// 1) Time for them to respond;
// 2) Measure their speed;
// 3) Amount and availability.
if
peer
:=
d
.
peers
.
Peer
(
pid
);
peer
!=
nil
{
peer
.
Demote
()
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"%s: block delivery timeout"
,
peer
)
}
}
// After removing bad peers make sure we actually have sufficient peer left to keep downloading
if
d
.
peers
.
Len
()
==
0
{
return
errNoPeers
}
// If there are unrequested hashes left start fetching
// from the available peers.
// If there are unrequested hashes left start fetching from the available peers
if
d
.
queue
.
Pending
()
>
0
{
// Throttle the download if block cache is full and waiting processing
if
d
.
queue
.
Throttle
()
{
...
...
@@ -565,7 +559,7 @@ func (d *Downloader) banBlocks(peerId string, head common.Hash) error {
return
err
}
// Wait a bit for the reply to arrive, and ban if done so
timeout
:=
time
.
After
(
blockTTL
)
timeout
:=
time
.
After
(
block
Hard
TTL
)
for
{
select
{
case
<-
d
.
cancelCh
:
...
...
@@ -574,6 +568,9 @@ func (d *Downloader) banBlocks(peerId string, head common.Hash) error {
case
<-
timeout
:
return
ErrTimeout
case
<-
d
.
hashCh
:
// Out of bounds hashes received, ignore them
case
blockPack
:=
<-
d
.
blockCh
:
blocks
:=
blockPack
.
blocks
...
...
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