Restart tor connection pool when the tor port setting is changed

Otherwise the old port continued to be used until the program
was restarted.

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor 2021-07-19 14:01:40 -07:00 committed by Jesús
parent 5df5e99213
commit d0e3adab01
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -71,6 +71,10 @@ class TorManager:
'socks5h://127.0.0.1:' + str(settings.tor_port) + '/',
cert_reqs='CERT_REQUIRED')
self.tor_pool_refresh_time = time.monotonic()
settings.add_setting_changed_hook(
'tor_port',
lambda old_val, new_val: self.refresh_tor_connection_pool(),
)
self.new_identity_lock = gevent.lock.BoundedSemaphore(1)
self.last_new_identity_time = time.monotonic() - 20