fix(config): fully disable p2p activity if option with p2p search disabled
This commit is contained in:
parent
acd549ea8f
commit
659a2aa002
@ -51,6 +51,13 @@ class p2p {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.tcpServer.on('connection', (socket) => {
|
this.tcpServer.on('connection', (socket) => {
|
||||||
|
if(!config.p2p)
|
||||||
|
{
|
||||||
|
logT('p2p', 'ignore incoming p2p connection because of p2p disabled')
|
||||||
|
socket.destroy()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.tcpServer.getConnections((err,con) => {
|
this.tcpServer.getConnections((err,con) => {
|
||||||
logT('p2p', 'server connected', con, 'max', this.tcpServer.maxConnections)
|
logT('p2p', 'server connected', con, 'max', this.tcpServer.maxConnections)
|
||||||
})
|
})
|
||||||
@ -264,6 +271,9 @@ class p2p {
|
|||||||
add(address) {
|
add(address) {
|
||||||
const { peers } = this
|
const { peers } = this
|
||||||
|
|
||||||
|
if(!config.p2p)
|
||||||
|
return
|
||||||
|
|
||||||
if(this.size > config.p2pConnections)
|
if(this.size > config.p2pConnections)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
|||||||
})
|
})
|
||||||
|
|
||||||
let p2pBootstrapLoop = null
|
let p2pBootstrapLoop = null
|
||||||
if(config.p2pBootstrap)
|
if(config.p2p && config.p2pBootstrap)
|
||||||
{
|
{
|
||||||
const loadBootstrapPeers = async (url) => {
|
const loadBootstrapPeers = async (url) => {
|
||||||
const json = await getServiceJson(url)
|
const json = await getServiceJson(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user