Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ffb5b37

Browse files
committed
feat: limit connections number
1 parent 00e0528 commit ffb5b37

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@
126126
"joi": "^14.3.0",
127127
"joi-browser": "^13.4.0",
128128
"joi-multiaddr": "^4.0.0",
129-
"libp2p": "~0.25.0-rc.0",
129+
"libp2p": "libp2p/js-libp2p#master",
130130
"libp2p-bootstrap": "~0.9.3",
131131
"libp2p-crypto": "~0.16.0",
132-
"libp2p-kad-dht": "~0.14.4",
132+
"libp2p-kad-dht": "~0.14.5",
133133
"libp2p-keychain": "~0.3.3",
134134
"libp2p-mdns": "~0.12.0",
135135
"libp2p-mplex": "~0.8.4",

src/core/components/libp2p.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
9393
}
9494
},
9595
connectionManager: get(options, 'connectionManager',
96-
get(config, 'connectionManager', {}))
96+
{
97+
maxPeers: get(config, 'Swarm.ConnMgr.HighWater'),
98+
minPeers: get(config, 'Swarm.ConnMgr.LowWater')
99+
})
97100
}
98101

99102
const libp2pOptions = defaultsDeep(get(options, 'libp2p', {}), libp2pDefaults)

src/core/runtime/config-browser.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,11 @@ module.exports = () => ({
2525
'/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
2626
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
2727
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
28-
]
28+
],
29+
Swarm: {
30+
ConnMgr: {
31+
LowWater: 600,
32+
HighWater: 900
33+
}
34+
}
2935
})

src/core/runtime/config-nodejs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,11 @@ module.exports = () => ({
3838
'/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
3939
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
4040
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
41-
]
41+
],
42+
Swarm: {
43+
ConnMgr: {
44+
LowWater: 600,
45+
HighWater: 900
46+
}
47+
}
4248
})

0 commit comments

Comments
 (0)