Use DNS seed only if knownnodes are empty

This commit is contained in:
Dmitri Bogomolov 2018-07-22 19:24:08 +03:00
parent 3ce4694591
commit 342e2a209c
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -8,6 +8,7 @@ import re
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from debug import logger from debug import logger
import helper_bootstrap import helper_bootstrap
from knownnodes import knownNodes
from network.proxy import Proxy from network.proxy import Proxy
from network.tcp import TCPServer, Socks5BMConnection, Socks4aBMConnection, TCPConnection from network.tcp import TCPServer, Socks5BMConnection, Socks4aBMConnection, TCPConnection
from network.udp import UDPSocket from network.udp import UDPSocket
@ -138,8 +139,9 @@ class BMConnectionPool(object):
acceptConnections = False acceptConnections = False
if spawnConnections: if spawnConnections:
if not self.bootstrapped: if not any([knownNodes.iteritems()]):
helper_bootstrap.dns() helper_bootstrap.dns()
if not self.bootstrapped:
self.bootstrapped = True self.bootstrapped = True
Proxy.proxy = (BMConfigParser().safeGet("bitmessagesettings", "sockshostname"), Proxy.proxy = (BMConfigParser().safeGet("bitmessagesettings", "sockshostname"),
BMConfigParser().safeGetInt("bitmessagesettings", "socksport")) BMConfigParser().safeGetInt("bitmessagesettings", "socksport"))