Skip to content

Commit ba90a4a

Browse files
fjlkaralabe
authored andcommitted
common/fdlimit: fix windows build (ethereum#19068)
1 parent 325334f commit ba90a4a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

common/fdlimit/fdlimit_windows.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package fdlimit
1818

19-
import "errors"
19+
import "fmt"
20+
21+
const hardlimit = 16384
2022

2123
// Raise tries to maximize the file descriptor allowance of this process
2224
// to the maximum hard-limit allowed by the OS.
@@ -27,8 +29,8 @@ func Raise(max uint64) (uint64, error) {
2729
// changeable from within a running process
2830
// This way we can always "request" raising the limits, which will either have
2931
// or not have effect based on the platform we're running on.
30-
if max > 16384 {
31-
return errors.New("file descriptor limit (16384) reached")
32+
if max > hardlimit {
33+
return hardlimit, fmt.Errorf("file descriptor limit (%d) reached", hardlimit)
3234
}
3335
return max, nil
3436
}
@@ -37,7 +39,7 @@ func Raise(max uint64) (uint64, error) {
3739
// process.
3840
func Current() (int, error) {
3941
// Please see Raise for the reason why we use hard coded 16K as the limit
40-
return 16384, nil
42+
return hardlimit, nil
4143
}
4244

4345
// Maximum retrieves the maximum number of file descriptors this process is

0 commit comments

Comments
 (0)