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
6f5c6150
Commit
6f5c6150
authored
Jun 12, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1255 from obscuren/chain-proc-interupt
eth, core: interrupt the chain processing on stop
parents
1bca2f6e
645dfd96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
chain_manager.go
core/chain_manager.go
+10
-1
backend.go
eth/backend.go
+1
-1
No files found.
core/chain_manager.go
View file @
6f5c6150
...
...
@@ -8,6 +8,7 @@ import (
"os"
"runtime"
"sync"
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -101,7 +102,9 @@ type ChainManager struct {
futureBlocks
*
BlockCache
quit
chan
struct
{}
wg
sync
.
WaitGroup
// procInterrupt must be atomically called
procInterrupt
int32
// interrupt signaler for block processing
wg
sync
.
WaitGroup
pow
pow
.
PoW
}
...
...
@@ -516,6 +519,7 @@ func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) {
func
(
bc
*
ChainManager
)
Stop
()
{
close
(
bc
.
quit
)
atomic
.
StoreInt32
(
&
bc
.
procInterrupt
,
1
)
bc
.
wg
.
Wait
()
...
...
@@ -569,6 +573,11 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
txcount
:=
0
for
i
,
block
:=
range
chain
{
if
atomic
.
LoadInt32
(
&
self
.
procInterrupt
)
==
1
{
glog
.
V
(
logger
.
Debug
)
.
Infoln
(
"Premature abort during chain processing"
)
break
}
bstart
:=
time
.
Now
()
// Wait for block i's nonce to be verified before processing
// its state transition.
...
...
eth/backend.go
View file @
6f5c6150
...
...
@@ -527,8 +527,8 @@ func (self *Ethereum) AddPeer(nodeURL string) error {
func
(
s
*
Ethereum
)
Stop
()
{
s
.
net
.
Stop
()
s
.
protocolManager
.
Stop
()
s
.
chainManager
.
Stop
()
s
.
protocolManager
.
Stop
()
s
.
txPool
.
Stop
()
s
.
eventMux
.
Stop
()
if
s
.
whisper
!=
nil
{
...
...
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