mirror of https://github.com/golang/go.git
net: don't assume that NOFILE rlimit fits in an int
No test because a test requires a system on which we can set RLIMIT_NOFILE to RLIM_INFINITY, which we normally can't. Fixes #59242 Change-Id: I8fc30e4206bb2be46369b5342360de556ce75a96 Reviewed-on: https://go-review.googlesource.com/c/go/+/479436 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
1ae306a5be
commit
0393934fa4
|
|
@ -148,11 +148,11 @@ func concurrentThreadsLimit() int {
|
|||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlim); err != nil {
|
||||
return 500
|
||||
}
|
||||
r := int(rlim.Cur)
|
||||
r := rlim.Cur
|
||||
if r > 500 {
|
||||
r = 500
|
||||
} else if r > 30 {
|
||||
r -= 30
|
||||
}
|
||||
return r
|
||||
return int(r)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue