Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
mybee
Commits
a703f308
Unverified
Commit
a703f308
authored
May 28, 2021
by
acud
Committed by
GitHub
May 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dont communicate lightnodes (#1895)
parent
8d961da1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
6 deletions
+11
-6
connections_test.go
pkg/p2p/libp2p/connections_test.go
+1
-1
libp2p.go
pkg/p2p/libp2p/libp2p.go
+1
-1
p2p.go
pkg/p2p/p2p.go
+1
-1
kademlia.go
pkg/topology/kademlia/kademlia.go
+8
-3
No files found.
pkg/p2p/libp2p/connections_test.go
View file @
a703f308
...
...
@@ -744,7 +744,7 @@ func (n *notifiee) Pick(p p2p.Peer) bool {
return
n
.
pick
}
func
(
n
*
notifiee
)
Announce
(
context
.
Context
,
swarm
.
Address
)
error
{
func
(
n
*
notifiee
)
Announce
(
context
.
Context
,
swarm
.
Address
,
bool
)
error
{
return
nil
}
...
...
pkg/p2p/libp2p/libp2p.go
View file @
a703f308
...
...
@@ -336,7 +336,7 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
if
!
i
.
FullNode
{
s
.
lightNodes
.
Connected
(
ctx
,
peer
)
//light node announces explicitly
if
err
:=
s
.
notifier
.
Announce
(
ctx
,
peer
.
Address
);
err
!=
nil
{
if
err
:=
s
.
notifier
.
Announce
(
ctx
,
peer
.
Address
,
i
.
FullNode
);
err
!=
nil
{
s
.
logger
.
Debugf
(
"stream handler: notifier.Announce: %s: %v"
,
peer
.
Address
.
String
(),
err
)
}
}
else
if
err
:=
s
.
notifier
.
Connected
(
ctx
,
peer
);
err
!=
nil
{
// full node announces implicitly
...
...
pkg/p2p/p2p.go
View file @
a703f308
...
...
@@ -44,7 +44,7 @@ type PickyNotifier interface {
type
Notifier
interface
{
Connected
(
context
.
Context
,
Peer
)
error
Disconnected
(
Peer
)
Announce
(
context
.
Context
,
swarm
.
Address
)
error
Announce
(
context
.
Context
,
swarm
.
Address
,
bool
)
error
}
// DebugService extends the Service with method used for debugging.
...
...
pkg/topology/kademlia/kademlia.go
View file @
a703f308
...
...
@@ -690,12 +690,12 @@ func (k *Kad) connect(ctx context.Context, peer swarm.Address, ma ma.Multiaddr)
return
errOverlayMismatch
}
return
k
.
Announce
(
ctx
,
peer
)
return
k
.
Announce
(
ctx
,
peer
,
true
)
}
// Announce a newly connected peer to our connected peers, but also
// notify the peer about our already connected peers
func
(
k
*
Kad
)
Announce
(
ctx
context
.
Context
,
peer
swarm
.
Address
)
error
{
func
(
k
*
Kad
)
Announce
(
ctx
context
.
Context
,
peer
swarm
.
Address
,
fullnode
bool
)
error
{
addrs
:=
[]
swarm
.
Address
{}
for
bin
:=
uint8
(
0
);
bin
<
swarm
.
MaxBins
;
bin
++
{
...
...
@@ -712,6 +712,11 @@ func (k *Kad) Announce(ctx context.Context, peer swarm.Address) error {
addrs
=
append
(
addrs
,
connectedPeer
)
if
!
fullnode
{
// we continue here so we dont gossip
// about lightnodes to others.
continue
}
k
.
wg
.
Add
(
1
)
go
func
(
connectedPeer
swarm
.
Address
)
{
defer
k
.
wg
.
Done
()
...
...
@@ -784,7 +789,7 @@ connected:
}
func
(
k
*
Kad
)
connected
(
ctx
context
.
Context
,
addr
swarm
.
Address
)
error
{
if
err
:=
k
.
Announce
(
ctx
,
addr
);
err
!=
nil
{
if
err
:=
k
.
Announce
(
ctx
,
addr
,
true
);
err
!=
nil
{
return
err
}
...
...
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