good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
maticnetwork
bor
Commits
b0ff946b
Commit
b0ff946b
authored
Jan 6, 2015
by
Felix Lange
Browse files
Options
Downloads
Patches
Plain Diff
p2p: move peerList back into baseProtocol
It had been moved to Peer, probably for debugging.
parent
eb0e7b1b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
p2p/peer.go
+0
-22
0 additions, 22 deletions
p2p/peer.go
p2p/protocol.go
+23
-1
23 additions, 1 deletion
p2p/protocol.go
with
23 additions
and
23 deletions
p2p/peer.go
+
0
−
22
View file @
b0ff946b
...
...
@@ -460,25 +460,3 @@ func (r *eofSignal) Read(buf []byte) (int, error) {
}
return
n
,
err
}
func
(
peer
*
Peer
)
PeerList
()
[]
interface
{}
{
peers
:=
peer
.
otherPeers
()
ds
:=
make
([]
interface
{},
0
,
len
(
peers
))
for
_
,
p
:=
range
peers
{
p
.
infolock
.
Lock
()
addr
:=
p
.
listenAddr
p
.
infolock
.
Unlock
()
// filter out this peer and peers that are not listening or
// have not completed the handshake.
// TODO: track previously sent peers and exclude them as well.
if
p
==
peer
||
addr
==
nil
{
continue
}
ds
=
append
(
ds
,
addr
)
}
ourAddr
:=
peer
.
ourListenAddr
if
ourAddr
!=
nil
&&
!
ourAddr
.
IP
.
IsLoopback
()
&&
!
ourAddr
.
IP
.
IsUnspecified
()
{
ds
=
append
(
ds
,
ourAddr
)
}
return
ds
}
This diff is collapsed.
Click to expand it.
p2p/protocol.go
+
23
−
1
View file @
b0ff946b
...
...
@@ -169,7 +169,7 @@ func (bp *baseProtocol) handle(rw MsgReadWriter) error {
case
pongMsg
:
case
getPeersMsg
:
peers
:=
bp
.
peer
.
Peer
List
()
peers
:=
bp
.
peerList
()
// this is dangerous. the spec says that we should _delay_
// sending the response if no new information is available.
// this means that would need to send a response later when
...
...
@@ -264,3 +264,25 @@ func (bp *baseProtocol) handshakeMsg() Msg {
bp
.
peer
.
ourID
.
Pubkey
()[
1
:
],
)
}
func
(
bp
*
baseProtocol
)
peerList
()
[]
interface
{}
{
peers
:=
bp
.
peer
.
otherPeers
()
ds
:=
make
([]
interface
{},
0
,
len
(
peers
))
for
_
,
p
:=
range
peers
{
p
.
infolock
.
Lock
()
addr
:=
p
.
listenAddr
p
.
infolock
.
Unlock
()
// filter out this peer and peers that are not listening or
// have not completed the handshake.
// TODO: track previously sent peers and exclude them as well.
if
p
==
bp
.
peer
||
addr
==
nil
{
continue
}
ds
=
append
(
ds
,
addr
)
}
ourAddr
:=
bp
.
peer
.
ourListenAddr
if
ourAddr
!=
nil
&&
!
ourAddr
.
IP
.
IsLoopback
()
&&
!
ourAddr
.
IP
.
IsUnspecified
()
{
ds
=
append
(
ds
,
ourAddr
)
}
return
ds
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment