Import peers in main_loop

Also only if peer discovery is enabled.  It's less confusing
that way.
This commit is contained in:
Neil Booth 2018-03-10 09:48:04 +08:00
parent e2f1864a94
commit ebc83b4028

View File

@ -240,7 +240,6 @@ class PeerManager(util.LoggedClass):
self.permit_onion_peer_time = time.time()
self.proxy = SocksProxy(env.tor_proxy_host, env.tor_proxy_port,
loop=self.loop)
self.import_peers()
def my_clearnet_peer(self):
'''Returns the clearnet peer representing this server, if any.'''
@ -427,6 +426,8 @@ class PeerManager(util.LoggedClass):
self.logger.info('peer discovery is disabled')
return
self.import_peers()
# Wait a few seconds after starting the proxy detection loop
# for proxy detection to succeed
self.ensure_future(self.proxy.auto_detect_loop())