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

Commit

Permalink
feat: limit connections number
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Feb 14, 2019
1 parent 00e0528 commit ffb5b37
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@
"joi": "^14.3.0",
"joi-browser": "^13.4.0",
"joi-multiaddr": "^4.0.0",
"libp2p": "~0.25.0-rc.0",
"libp2p": "libp2p/js-libp2p#master",
"libp2p-bootstrap": "~0.9.3",
"libp2p-crypto": "~0.16.0",
"libp2p-kad-dht": "~0.14.4",
"libp2p-kad-dht": "~0.14.5",
"libp2p-keychain": "~0.3.3",
"libp2p-mdns": "~0.12.0",
"libp2p-mplex": "~0.8.4",
Expand Down
5 changes: 4 additions & 1 deletion src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
}
},
connectionManager: get(options, 'connectionManager',
get(config, 'connectionManager', {}))
{
maxPeers: get(config, 'Swarm.ConnMgr.HighWater'),
minPeers: get(config, 'Swarm.ConnMgr.LowWater')
})
}

const libp2pOptions = defaultsDeep(get(options, 'libp2p', {}), libp2pDefaults)
Expand Down
8 changes: 7 additions & 1 deletion src/core/runtime/config-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@ module.exports = () => ({
'/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
]
],
Swarm: {
ConnMgr: {
LowWater: 600,
HighWater: 900
}
}
})
8 changes: 7 additions & 1 deletion src/core/runtime/config-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ module.exports = () => ({
'/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx',
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
]
],
Swarm: {
ConnMgr: {
LowWater: 600,
HighWater: 900
}
}
})

0 comments on commit ffb5b37

Please sign in to comment.