Compare commits

...

2 Commits

Author SHA1 Message Date
Kevin Froman d244b1ba77 catch subprocess err in 3.9.x (dirty hack 1 year ago
Kevin Froman b8a74fac97 * revert pow to 5 1 year ago
  1. 4
      scripts/disable-dev-config.py
  2. 15
      src/onionrproofs/subprocesspow.py
  3. 4
      src/sneakernet/__init__.py
  4. 2
      static-data/default_config.json
  5. 4
      tests/test_default_config_json.py

4
scripts/disable-dev-config.py

@ -18,8 +18,8 @@ conf['general']['display_header'] = True
conf['general']['security_level'] = 0
conf['general']['use_bootstrap_list'] = True
conf['onboarding']['done'] = False
conf['general']['minimum_block_pow'] = 6
conf['general']['minimum_send_pow'] = 6
conf['general']['minimum_block_pow'] = 5
conf['general']['minimum_send_pow'] = 5
conf['log']['file']['remove_on_exit'] = True
conf['transports']['lan'] = True
conf['transports']['tor'] = True

15
src/onionrproofs/subprocesspow.py

@ -91,10 +91,17 @@ class SubprocessPOW:
def _spawn_proc(self):
"""Create a child proof of work process
wait for data and send shutdown signal when its found"""
parent_conn, child_conn = Pipe()
p = Process(target=self.do_pow, args=(child_conn,), daemon=True)
p.start()
#p.join()
# The importerror started happening in 3.9.x
# not worth fixing because this POW will be replaced by VDF
try:
parent_conn, child_conn = Pipe()
p = Process(target=self.do_pow, args=(child_conn,), daemon=True)
p.start()
except ImportError:
logger.error(
"Error in subprocess module when getting new POW " +
"pipe.\nThis is related to a problem in 3.9.x", terminal=True)
return
payload = None
try:
while True:

4
src/sneakernet/__init__.py

@ -63,6 +63,6 @@ def sneakernet_import_thread():
for path in watch_paths:
observer.schedule(_Importer(), path, recursive=True)
observer.start()
while observer.isAlive():
while observer.is_alive():
# call import func with timeout
observer.join(60)
observer.join(60)

2
static-data/default_config.json

@ -77,4 +77,4 @@
"public_remote_hosts": [],
"theme": "dark"
}
}
}

4
tests/test_default_config_json.py

@ -30,8 +30,8 @@ class OnionrConfig(unittest.TestCase):
self.assertEqual(conf['general']['ephemeral_tunnels'], False)
self.assertEqual(conf['general']['hide_created_blocks'], True)
self.assertEqual(conf['general']['insert_deniable_blocks'], True)
self.assertEqual(conf['general']['minimum_block_pow'], 6)
self.assertEqual(conf['general']['minimum_send_pow'], 6)
self.assertEqual(conf['general']['minimum_block_pow'], 5)
self.assertEqual(conf['general']['minimum_send_pow'], 5)
self.assertEqual(conf['general']['public_key'], '')
self.assertEqual(conf['general']['random_bind_ip'], True)
self.assertEqual(conf['general']['security_level'], 0)

Loading…
Cancel
Save