Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goshimmer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iota-imt
goshimmer
Commits
b8c48b20
Unverified
Commit
b8c48b20
authored
5 years ago
by
Wolfgang Welz
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Deadlock in TestDropNeighbor (#362)
parent
ca1d9f1d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/gossip/manager_test.go
+12
-4
12 additions, 4 deletions
packages/gossip/manager_test.go
with
12 additions
and
4 deletions
packages/gossip/manager_test.go
+
12
−
4
View file @
b8c48b20
...
@@ -387,7 +387,7 @@ func TestDropNeighbor(t *testing.T) {
...
@@ -387,7 +387,7 @@ func TestDropNeighbor(t *testing.T) {
go
func
()
{
assert
.
NoError
(
t
,
mgrA
.
AddInbound
(
peerB
))
}()
go
func
()
{
assert
.
NoError
(
t
,
mgrA
.
AddInbound
(
peerB
))
}()
go
func
()
{
assert
.
NoError
(
t
,
mgrB
.
AddOutbound
(
peerA
))
}()
go
func
()
{
assert
.
NoError
(
t
,
mgrB
.
AddOutbound
(
peerA
))
}()
wg
.
Wait
()
// wait until the events were triggered
wg
.
Wait
()
// wait until the events were triggered
and the peers are connected
}
}
disc
:=
func
()
{
disc
:=
func
()
{
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
...
@@ -396,9 +396,17 @@ func TestDropNeighbor(t *testing.T) {
...
@@ -396,9 +396,17 @@ func TestDropNeighbor(t *testing.T) {
Events
.
NeighborRemoved
.
Attach
(
closure
)
Events
.
NeighborRemoved
.
Attach
(
closure
)
defer
Events
.
NeighborRemoved
.
Detach
(
closure
)
defer
Events
.
NeighborRemoved
.
Detach
(
closure
)
go
func
()
{
_
=
mgrA
.
DropNeighbor
(
peerB
.
ID
())
}()
// assure that no DropNeighbor calls are leaking
go
func
()
{
_
=
mgrB
.
DropNeighbor
(
peerA
.
ID
())
}()
wg
.
Add
(
2
)
wg
.
Wait
()
// wait until the events were triggered
go
func
()
{
defer
wg
.
Done
()
_
=
mgrA
.
DropNeighbor
(
peerB
.
ID
())
}()
go
func
()
{
defer
wg
.
Done
()
_
=
mgrB
.
DropNeighbor
(
peerA
.
ID
())
}()
wg
.
Wait
()
// wait until the events were triggered and the go routines are done
}
}
// drop and connect many many times
// drop and connect many many times
...
...
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