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
9c5bf9c2
Unverified
Commit
9c5bf9c2
authored
Dec 20, 2020
by
Nemanja Zbiljić
Committed by
GitHub
Dec 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If P2P connection exists compare overlay address (#1059)
parent
f365a29a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
kademlia.go
pkg/kademlia/kademlia.go
+4
-0
libp2p.go
pkg/p2p/libp2p/libp2p.go
+6
-2
No files found.
pkg/kademlia/kademlia.go
View file @
9c5bf9c2
...
...
@@ -336,6 +336,10 @@ func (k *Kad) connect(ctx context.Context, peer swarm.Address, ma ma.Multiaddr,
i
,
err
:=
k
.
p2p
.
Connect
(
ctx
,
ma
)
if
err
!=
nil
{
if
errors
.
Is
(
err
,
p2p
.
ErrAlreadyConnected
)
{
if
!
i
.
Overlay
.
Equal
(
peer
)
{
return
errOverlayMismatch
}
return
nil
}
...
...
pkg/p2p/libp2p/libp2p.go
View file @
9c5bf9c2
...
...
@@ -453,8 +453,12 @@ func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (address *bzz.
remoteAddr
:=
addr
.
Decapsulate
(
hostAddr
)
if
_
,
found
:=
s
.
peers
.
isConnected
(
info
.
ID
,
remoteAddr
);
found
{
return
nil
,
p2p
.
ErrAlreadyConnected
if
overlay
,
found
:=
s
.
peers
.
isConnected
(
info
.
ID
,
remoteAddr
);
found
{
address
=
&
bzz
.
Address
{
Overlay
:
overlay
,
Underlay
:
addr
,
}
return
address
,
p2p
.
ErrAlreadyConnected
}
if
err
:=
s
.
connectionBreaker
.
Execute
(
func
()
error
{
return
s
.
host
.
Connect
(
ctx
,
*
info
)
});
err
!=
nil
{
...
...
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