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
9559b532
Commit
9559b532
authored
Sep 17, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Past peers option
parent
eb32fe20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
ethereum.go
ethereum.go
+14
-5
No files found.
ethereum.go
View file @
9559b532
...
@@ -399,9 +399,7 @@ func (s *Ethereum) Start(seed bool) {
...
@@ -399,9 +399,7 @@ func (s *Ethereum) Start(seed bool) {
}
}
func
(
s
*
Ethereum
)
Seed
()
{
func
(
s
*
Ethereum
)
Seed
()
{
var
ips
[]
string
ips
:=
PastPeers
()
data
,
_
:=
ethutil
.
ReadAllFile
(
path
.
Join
(
ethutil
.
Config
.
ExecPath
,
"known_peers.json"
))
json
.
Unmarshal
([]
byte
(
data
),
&
ips
)
if
len
(
ips
)
>
0
{
if
len
(
ips
)
>
0
{
for
_
,
ip
:=
range
ips
{
for
_
,
ip
:=
range
ips
{
ethlogger
.
Infoln
(
"Connecting to previous peer "
,
ip
)
ethlogger
.
Infoln
(
"Connecting to previous peer "
,
ip
)
...
@@ -473,8 +471,11 @@ func (s *Ethereum) Stop() {
...
@@ -473,8 +471,11 @@ func (s *Ethereum) Stop() {
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
ips
=
append
(
ips
,
p
.
conn
.
RemoteAddr
()
.
String
())
ips
=
append
(
ips
,
p
.
conn
.
RemoteAddr
()
.
String
())
})
})
d
,
_
:=
json
.
MarshalIndent
(
ips
,
""
,
" "
)
ethutil
.
WriteFile
(
path
.
Join
(
ethutil
.
Config
.
ExecPath
,
"known_peers.json"
),
d
)
if
len
(
ips
)
>
0
{
d
,
_
:=
json
.
MarshalIndent
(
ips
,
""
,
" "
)
ethutil
.
WriteFile
(
path
.
Join
(
ethutil
.
Config
.
ExecPath
,
"known_peers.json"
),
d
)
}
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
p
.
Stop
()
p
.
Stop
()
...
@@ -620,3 +621,11 @@ func bootstrapDb(db ethutil.Database) {
...
@@ -620,3 +621,11 @@ func bootstrapDb(db ethutil.Database) {
db
.
Put
([]
byte
(
"ProtocolVersion"
),
ethutil
.
NewValue
(
ProtocolVersion
)
.
Bytes
())
db
.
Put
([]
byte
(
"ProtocolVersion"
),
ethutil
.
NewValue
(
ProtocolVersion
)
.
Bytes
())
}
}
}
}
func
PastPeers
()
[]
string
{
var
ips
[]
string
data
,
_
:=
ethutil
.
ReadAllFile
(
path
.
Join
(
ethutil
.
Config
.
ExecPath
,
"known_peers.json"
))
json
.
Unmarshal
([]
byte
(
data
),
&
ips
)
return
ips
}
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