diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-07-19 14:01:40 -0700 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-07-28 23:18:22 -0500 |
commit | d0e3adab0115c547eb58d34337dca7bfce629be2 (patch) | |
tree | 55acee43227d76c906a7d2e2116c3dc71838b43f /youtube | |
parent | 5df5e9921385d8c40c4929e162bcfde98a68dbf7 (diff) | |
download | yt-local-d0e3adab0115c547eb58d34337dca7bfce629be2.tar.lz yt-local-d0e3adab0115c547eb58d34337dca7bfce629be2.tar.xz yt-local-d0e3adab0115c547eb58d34337dca7bfce629be2.zip |
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>
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/util.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube/util.py b/youtube/util.py index ca4faa2..e62d575 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -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 |