Fix: RM: Set no-limit value to 1e9 (1000000000).
Added a comment next to the value to make possible to people to grep over the code and find where that value is set. Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Antonio Navarro Perez committed
Dec 7, 2022 at 10:26 UTC
96bbd53033ac56e5c7f728a99e4fb5a9a5fe1dcb
1 file changed
+2
-4
core/node/libp2p/rcmgr_defaults.go
+2
-4
@@ -1,8 +1,6 @@
1
package libp2p
2
3
import (
4
- "math"
5
-
4
"github.com/dustin/go-humanize"
5
"github.com/libp2p/go-libp2p"
6
rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager"
@@ -16,8 +14,8 @@ import (
14
// When you don't have a type the JSON Parse function cast numbers to float64 by default,
15
// losing precision when writing the final number. So if we use math.MaxInt as our infinite number,
16
// after writing the config file we will have 9223372036854776000 instead of 9223372036854775807,
19
-// making the parsing process fail.
20
-const bigEnough = math.MaxInt / 2
17
+// making the parsing process fail. Setting 1e9 (1000000000) as "no limit" value. It also avoids to overflow on 32 bit architectures.
18
+const bigEnough = 1e9
19
20
var infiniteBaseLimit = rcmgr.BaseLimit{
21
Streams: bigEnough,