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
6a19b62d
Commit
6a19b62d
authored
Jul 17, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added chainSync event
parent
a626b7eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
ethereum.go
ethereum.go
+24
-0
No files found.
ethereum.go
View file @
6a19b62d
...
...
@@ -80,6 +80,8 @@ type Ethereum struct {
keyManager
*
ethcrypto
.
KeyManager
clientIdentity
ethwire
.
ClientIdentity
isUpToDate
bool
}
func
New
(
db
ethutil
.
Database
,
clientIdentity
ethwire
.
ClientIdentity
,
keyManager
*
ethcrypto
.
KeyManager
,
caps
Caps
,
usePnp
bool
)
(
*
Ethereum
,
error
)
{
...
...
@@ -107,6 +109,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager
nat
:
nat
,
keyManager
:
keyManager
,
clientIdentity
:
clientIdentity
,
isUpToDate
:
true
,
}
ethereum
.
reactor
=
ethutil
.
NewReactorEngine
()
...
...
@@ -371,6 +374,7 @@ func (s *Ethereum) Start(seed bool) {
// Start the reaping processes
go
s
.
ReapDeadPeerHandler
()
go
s
.
update
()
if
seed
{
s
.
Seed
()
...
...
@@ -510,3 +514,23 @@ out:
ethlogger
.
Debugln
(
"succesfully disestablished UPnP port mapping"
)
}
}
func
(
self
*
Ethereum
)
update
()
{
upToDateTimer
:=
time
.
NewTicker
(
1
*
time
.
Second
)
out
:
for
{
select
{
case
<-
upToDateTimer
.
C
:
if
self
.
IsUpToDate
()
&&
!
self
.
isUpToDate
{
self
.
reactor
.
Post
(
"chainSync"
,
false
)
self
.
isUpToDate
=
true
}
else
if
!
self
.
IsUpToDate
()
&&
self
.
isUpToDate
{
self
.
reactor
.
Post
(
"chainSync"
,
true
)
self
.
isUpToDate
=
false
}
case
<-
self
.
quit
:
break
out
}
}
}
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