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
2019ed71
Commit
2019ed71
authored
Oct 28, 2015
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
eth: don't block sync goroutines that short circuit
parent
6b5a42a1
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
eth/downloader/downloader.go
+4
-2
4 additions, 2 deletions
eth/downloader/downloader.go
eth/sync.go
+5
-2
5 additions, 2 deletions
eth/sync.go
with
9 additions
and
4 deletions
eth/downloader/downloader.go
+
4
−
2
View file @
2019ed71
...
@@ -248,10 +248,11 @@ func (d *Downloader) UnregisterPeer(id string) error {
...
@@ -248,10 +248,11 @@ func (d *Downloader) UnregisterPeer(id string) error {
// Synchronise tries to sync up our local block chain with a remote peer, both
// Synchronise tries to sync up our local block chain with a remote peer, both
// adding various sanity checks as well as wrapping it with various log entries.
// adding various sanity checks as well as wrapping it with various log entries.
func
(
d
*
Downloader
)
Synchronise
(
id
string
,
head
common
.
Hash
,
td
*
big
.
Int
,
mode
SyncMode
)
{
func
(
d
*
Downloader
)
Synchronise
(
id
string
,
head
common
.
Hash
,
td
*
big
.
Int
,
mode
SyncMode
)
error
{
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Attempting synchronisation: %v, head [%x…], TD %v"
,
id
,
head
[
:
4
],
td
)
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Attempting synchronisation: %v, head [%x…], TD %v"
,
id
,
head
[
:
4
],
td
)
switch
err
:=
d
.
synchronise
(
id
,
head
,
td
,
mode
);
err
{
err
:=
d
.
synchronise
(
id
,
head
,
td
,
mode
)
switch
err
{
case
nil
:
case
nil
:
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Synchronisation completed"
)
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Synchronisation completed"
)
...
@@ -268,6 +269,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode
...
@@ -268,6 +269,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode
default
:
default
:
glog
.
V
(
logger
.
Warn
)
.
Infof
(
"Synchronisation failed: %v"
,
err
)
glog
.
V
(
logger
.
Warn
)
.
Infof
(
"Synchronisation failed: %v"
,
err
)
}
}
return
err
}
}
// synchronise will select the peer and use it for synchronising. If an empty string is given
// synchronise will select the peer and use it for synchronising. If an empty string is given
...
...
This diff is collapsed.
Click to expand it.
eth/sync.go
+
5
−
2
View file @
2019ed71
...
@@ -170,13 +170,16 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
...
@@ -170,13 +170,16 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
if
pm
.
fastSync
{
if
pm
.
fastSync
{
mode
=
downloader
.
FastSync
mode
=
downloader
.
FastSync
}
}
pm
.
downloader
.
Synchronise
(
peer
.
id
,
peer
.
Head
(),
peer
.
Td
(),
mode
)
if
err
:=
pm
.
downloader
.
Synchronise
(
peer
.
id
,
peer
.
Head
(),
peer
.
Td
(),
mode
);
err
!=
nil
{
return
}
// If fast sync was enabled, and we synced up, disable it
// If fast sync was enabled, and we synced up, disable it
if
pm
.
fastSync
{
if
pm
.
fastSync
{
// Wait until all pending imports finish processing
for
pm
.
downloader
.
Synchronising
()
{
for
pm
.
downloader
.
Synchronising
()
{
time
.
Sleep
(
100
*
time
.
Millisecond
)
time
.
Sleep
(
100
*
time
.
Millisecond
)
}
}
// Disable fast sync if we indeed have something in our chain
if
pm
.
blockchain
.
CurrentBlock
()
.
NumberU64
()
>
0
{
if
pm
.
blockchain
.
CurrentBlock
()
.
NumberU64
()
>
0
{
glog
.
V
(
logger
.
Info
)
.
Infof
(
"fast sync complete, auto disabling"
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"fast sync complete, auto disabling"
)
pm
.
fastSync
=
false
pm
.
fastSync
=
false
...
...
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