Faster start

This commit is contained in:
l-n-s
2018-01-14 06:09:45 -05:00
parent c165927321
commit 20ff4cae4f
2 changed files with 12 additions and 4 deletions

View File

@ -21,8 +21,8 @@ class TestnetCtl(object):
"""Start testnet"""
if not self.testnet.NODES:
self.testnet.create_network()
cid = self.testnet.run_i2pd(floodfill=True, with_seed=False)
time.sleep(5)
cid = self.testnet.run_i2pd(args=' --reseed.threshold=0 ',
floodfill=True, with_seed=False)
self.testnet.make_seed(cid)
print("*** Testnet is running")

View File

@ -4,6 +4,7 @@ import string
import tarfile
import zipfile
import tempfile
import time
import requests
@ -145,9 +146,16 @@ class Testnet(object):
def make_seed(self, cid):
"""creates a zip reseed file"""
ri_path = "/home/i2pd/data/router.info"
while True:
result = self.NODES[cid].container.exec_run(
"sh -c 'test {} && echo yes'".format(ri_path))
if result == b"yes\n": break
time.sleep(0.1)
with tempfile.TemporaryFile() as fp:
fp.write(self.NODES[cid].container.get_archive(
"/home/i2pd/data/router.info")[0].read())
fp.write(self.NODES[cid].container.get_archive(ri_path)[0].read())
fp.seek(0)
ri_file = tarfile.open(fileobj=fp, mode='r:')\
.extractfile("router.info").read()