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
9c03c374
Commit
9c03c374
authored
Jun 15, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: fix import statistic reset, fetch hashes async
parent
b240983e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
downloader.go
eth/downloader/downloader.go
+14
-11
No files found.
eth/downloader/downloader.go
View file @
9c03c374
...
...
@@ -316,13 +316,8 @@ func (d *Downloader) Cancel() {
}
d
.
cancelLock
.
Unlock
()
// Reset the queue
and import statistics
// Reset the queue
d
.
queue
.
Reset
()
d
.
importLock
.
Lock
()
d
.
importQueue
=
nil
d
.
importDone
=
0
d
.
importLock
.
Unlock
()
}
// fetchHahes starts retrieving hashes backwards from a specific peer and hash,
...
...
@@ -345,7 +340,7 @@ func (d *Downloader) fetchHashes(p *peer, h common.Hash) error {
<-
timeout
.
C
// timeout channel should be initially empty.
getHashes
:=
func
(
from
common
.
Hash
)
{
active
.
getHashes
(
from
)
go
active
.
getHashes
(
from
)
timeout
.
Reset
(
hashTTL
)
}
...
...
@@ -414,9 +409,9 @@ func (d *Downloader) fetchHashes(p *peer, h common.Hash) error {
expire
:
time
.
Now
()
.
Add
(
blockSoftTTL
),
parent
:
parent
,
}
active
.
getBlocks
([]
common
.
Hash
{
origin
})
go
active
.
getBlocks
([]
common
.
Hash
{
origin
})
// Also fetch a fresh
// Also fetch a fresh
batch of hashes
getHashes
(
head
)
continue
}
...
...
@@ -720,8 +715,16 @@ func (d *Downloader) process() (err error) {
err
=
d
.
process
()
}
}()
// Release the lock upon exit (note, before checking for reentry!)
defer
atomic
.
StoreInt32
(
&
d
.
processing
,
0
)
// Release the lock upon exit (note, before checking for reentry!), and set
// the import statistics to zero.
defer
func
()
{
d
.
importLock
.
Lock
()
d
.
importQueue
=
nil
d
.
importDone
=
0
d
.
importLock
.
Unlock
()
atomic
.
StoreInt32
(
&
d
.
processing
,
0
)
}()
// Fetch the current cancel channel to allow termination
d
.
cancelLock
.
RLock
()
...
...
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