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
da66eddf
Commit
da66eddf
authored
Jan 31, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get peers returns now both in and outbound peers
parent
dfa38b3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
ethereum.go
ethereum.go
+16
-0
peer.go
peer.go
+2
-2
No files found.
ethereum.go
View file @
da66eddf
...
...
@@ -144,6 +144,18 @@ func (s *Ethereum) InboundPeers() []*Peer {
return
inboundPeers
[
:
length
]
}
func
(
s
*
Ethereum
)
InOutPeers
()
[]
*
Peer
{
// Create a new peer slice with at least the length of the total peers
inboundPeers
:=
make
([]
*
Peer
,
s
.
peers
.
Len
())
length
:=
0
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
inboundPeers
[
length
]
=
p
length
++
})
return
inboundPeers
[
:
length
]
}
func
(
s
*
Ethereum
)
Broadcast
(
msgType
ethwire
.
MsgType
,
data
interface
{})
{
msg
:=
ethwire
.
NewMessage
(
msgType
,
data
)
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
...
...
@@ -151,6 +163,10 @@ func (s *Ethereum) Broadcast(msgType ethwire.MsgType, data interface{}) {
})
}
func
(
s
*
Ethereum
)
Peers
()
*
list
.
List
{
return
s
.
peers
}
func
(
s
*
Ethereum
)
ReapDeadPeers
()
{
for
{
eachPeer
(
s
.
peers
,
func
(
p
*
Peer
,
e
*
list
.
Element
)
{
...
...
peer.go
View file @
da66eddf
...
...
@@ -335,9 +335,9 @@ func (p *Peer) pushHandshake() error {
// Pushes the list of outbound peers to the client when requested
func
(
p
*
Peer
)
pushPeers
()
{
outPeers
:=
make
([]
interface
{},
len
(
p
.
ethereum
.
Outbound
Peers
()))
outPeers
:=
make
([]
interface
{},
len
(
p
.
ethereum
.
InOut
Peers
()))
// Serialise each peer
for
i
,
peer
:=
range
p
.
ethereum
.
Outbound
Peers
()
{
for
i
,
peer
:=
range
p
.
ethereum
.
InOut
Peers
()
{
outPeers
[
i
]
=
peer
.
RlpData
()
}
...
...
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