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
8931a3ef
Unverified
Commit
8931a3ef
authored
Feb 24, 2020
by
Petar Radovic
Committed by
GitHub
Feb 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix full connectivity add peer and test (#25)
parent
cc9f2dd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
connections_test.go
pkg/p2p/libp2p/connections_test.go
+18
-4
full.go
pkg/topology/full/full.go
+3
-1
No files found.
pkg/p2p/libp2p/connections_test.go
View file @
8931a3ef
...
...
@@ -359,22 +359,36 @@ func TestConnectWithMockDiscovery(t *testing.T) {
s2
,
_
,
cleanup2
:=
newService
(
t
,
o2
)
defer
cleanup2
()
s3
,
_
,
cleanup3
:=
newService
(
t
,
o2
)
defer
cleanup3
()
addrs
,
err
:=
s1
.
Addresses
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
addr
:=
addrs
[
0
]
overlay
,
err
:
=
s2
.
Connect
(
context
.
Background
(),
addr
)
_
,
err
=
s2
.
Connect
(
context
.
Background
(),
addr
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
v
:=
disc2
.
Broadcasts
();
v
!=
1
{
t
.
Fatalf
(
"expected
1
peer broadcasts, got %d"
,
v
)
if
v
:=
disc2
.
Broadcasts
();
v
!=
0
{
t
.
Fatalf
(
"expected
0
peer broadcasts, got %d"
,
v
)
}
if
err
:=
s2
.
Disconnect
(
overlay
);
err
!=
nil
{
addrs
,
err
=
s3
.
Addresses
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
addr
=
addrs
[
0
]
_
,
err
=
s2
.
Connect
(
context
.
Background
(),
addr
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
v
:=
disc2
.
Broadcasts
();
v
!=
1
{
t
.
Fatalf
(
"expected 1 peer broadcasts, got %d"
,
v
)
}
}
pkg/topology/full/full.go
View file @
8931a3ef
...
...
@@ -46,7 +46,6 @@ func (d *driver) AddPeer(overlay swarm.Address) error {
d
.
mtx
.
Lock
()
defer
d
.
mtx
.
Unlock
()
d
.
connected
[
overlay
.
String
()]
=
overlay
ma
,
exists
:=
d
.
addressBook
.
Get
(
overlay
)
if
!
exists
{
return
topology
.
ErrNotFound
...
...
@@ -58,6 +57,9 @@ func (d *driver) AddPeer(overlay swarm.Address) error {
return
err
}
}
// add peer in the end to avoid broadcast to itself
d
.
connected
[
overlay
.
String
()]
=
overlay
return
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