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
16a23ff7
Commit
16a23ff7
authored
May 31, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2637 from karalabe/downloader-always-cancel
eth/downloader: ensure cancel channel is closed post sync
parents
1d5d2172
4496a44f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
downloader.go
eth/downloader/downloader.go
+2
-0
downloader_test.go
eth/downloader/downloader_test.go
+11
-1
No files found.
eth/downloader/downloader.go
View file @
16a23ff7
...
...
@@ -326,6 +326,8 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode
d
.
cancelCh
=
make
(
chan
struct
{})
d
.
cancelLock
.
Unlock
()
defer
d
.
cancel
()
// No matter what, we can't leave the cancel channel open
// Set the requested sync mode, unless it's forbidden
d
.
mode
=
mode
if
d
.
mode
==
FastSync
&&
d
.
noFast
{
...
...
eth/downloader/downloader_test.go
View file @
16a23ff7
...
...
@@ -188,7 +188,17 @@ func (dl *downloadTester) sync(id string, td *big.Int, mode SyncMode) error {
}
}
dl
.
lock
.
RUnlock
()
return
dl
.
downloader
.
synchronise
(
id
,
hash
,
td
,
mode
)
// Synchronise with the chosen peer and ensure proper cleanup afterwards
err
:=
dl
.
downloader
.
synchronise
(
id
,
hash
,
td
,
mode
)
select
{
case
<-
dl
.
downloader
.
cancelCh
:
// Ok, downloader fully cancelled after sync cycle
default
:
// Downloader is still accepting packets, can block a peer up
panic
(
"downloader active post sync cycle"
)
// panic will be caught by tester
}
return
err
}
// hasHeader checks if a header is present in the testers canonical chain.
...
...
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