Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
052a1204
Commit
052a1204
authored
Oct 28, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test to stress the lock order race condition
parent
34e49ba4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
dial_sync_test.go
dial_sync_test.go
+24
-0
No files found.
dial_sync_test.go
View file @
052a1204
...
@@ -201,3 +201,27 @@ func TestFailFirst(t *testing.T) {
...
@@ -201,3 +201,27 @@ func TestFailFirst(t *testing.T) {
t
.
Fatal
(
"should have gotten a 'real' conn back"
)
t
.
Fatal
(
"should have gotten a 'real' conn back"
)
}
}
}
}
func
TestStressActiveDial
(
t
*
testing
.
T
)
{
ds
:=
NewDialSync
(
func
(
ctx
context
.
Context
,
p
peer
.
ID
)
(
*
Conn
,
error
)
{
return
nil
,
nil
})
wg
:=
sync
.
WaitGroup
{}
pid
:=
peer
.
ID
(
"foo"
)
makeDials
:=
func
()
{
for
i
:=
0
;
i
<
10000
;
i
++
{
ds
.
DialLock
(
context
.
Background
(),
pid
)
}
wg
.
Done
()
}
for
i
:=
0
;
i
<
100
;
i
++
{
wg
.
Add
(
1
)
go
makeDials
()
}
wg
.
Wait
()
}
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