Skip to content

Commit

Permalink
Fix a crash with protected Tor control port (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberTailor committed Jun 22, 2022
1 parent 966644b commit 194b2ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import urllib.parse as urlparse
import os
from stem import Signal, SocketError
from stem.connection import AuthenticationFailure
from stem.control import Controller
from stem.connection import authenticate_cookie, authenticate_password

Expand Down Expand Up @@ -63,7 +64,9 @@ def send_tor_signal(signal: Signal) -> bool:
c.signal(signal)
os.environ['TOR_AVAILABLE'] = '1'
return True
except (SocketError, ConnectionRefusedError, ConnectionError):
except (SocketError, AuthenticationFailure,
ConnectionRefusedError, ConnectionError):
# TODO: Handle Tor authentification (password and cookie)
os.environ['TOR_AVAILABLE'] = '0'

return False
Expand Down

0 comments on commit 194b2ea

Please sign in to comment.