Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
2019ed71
Commit
2019ed71
authored
Oct 28, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: don't block sync goroutines that short circuit
parent
6b5a42a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
downloader.go
eth/downloader/downloader.go
+4
-2
sync.go
eth/sync.go
+5
-2
No files found.
eth/downloader/downloader.go
View file @
2019ed71
...
...
@@ -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
// 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
)
switch
err
:=
d
.
synchronise
(
id
,
head
,
td
,
mode
);
err
{
err
:=
d
.
synchronise
(
id
,
head
,
td
,
mode
)
switch
err
{
case
nil
:
glog
.
V
(
logger
.
Detail
)
.
Infof
(
"Synchronisation completed"
)
...
...
@@ -268,6 +269,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode
default
:
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
...
...
eth/sync.go
View file @
2019ed71
...
...
@@ -170,13 +170,16 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
if
pm
.
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
pm
.
fastSync
{
// Wait until all pending imports finish processing
for
pm
.
downloader
.
Synchronising
()
{
time
.
Sleep
(
100
*
time
.
Millisecond
)
}
// Disable fast sync if we indeed have something in our chain
if
pm
.
blockchain
.
CurrentBlock
()
.
NumberU64
()
>
0
{
glog
.
V
(
logger
.
Info
)
.
Infof
(
"fast sync complete, auto disabling"
)
pm
.
fastSync
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment