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

feat: limit connections number #1872

Merged
merged 1 commit into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "~0.25.0-rc.3",
"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
}
}
})