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
f0aa4f29
Commit
f0aa4f29
authored
Apr 14, 2021
by
Cory Schwartz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix go vet
parent
68ae307f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
limiter_test.go
limiter_test.go
+14
-2
No files found.
limiter_test.go
View file @
f0aa4f29
...
...
@@ -2,6 +2,7 @@ package swarm
import
(
"context"
"errors"
"fmt"
"math/rand"
"strconv"
...
...
@@ -379,8 +380,12 @@ func TestFDLimitUnderflow(t *testing.T) {
addrs
=
append
(
addrs
,
addrWithPort
(
t
,
i
))
}
wg
:=
sync
.
WaitGroup
{}
wg
.
Add
(
1000
)
errs
:=
make
(
chan
error
,
1000
)
for
i
:=
0
;
i
<
1000
;
i
++
{
go
func
(
id
peer
.
ID
,
i
int
)
{
defer
wg
.
Done
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
resp
:=
make
(
chan
dialResult
)
...
...
@@ -406,12 +411,19 @@ func TestFDLimitUnderflow(t *testing.T) {
if
res
.
Err
!=
nil
{
return
}
t
.
Fatal
(
"got dial res, shouldn't"
)
errs
<-
errors
.
New
(
"got dial res,
but
shouldn't"
)
}
}(
peer
.
ID
(
fmt
.
Sprintf
(
"testpeer%d"
,
i
%
20
)),
i
)
}
time
.
Sleep
(
time
.
Second
*
3
)
go
func
()
{
wg
.
Wait
()
close
(
errs
)
}()
for
err
:=
range
errs
{
t
.
Fatal
(
err
)
}
l
.
lk
.
Lock
()
fdConsuming
:=
l
.
fdConsuming
...
...
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