From 0f92d926042ab7b290d7154a3ad31d8e27dc296a Mon Sep 17 00:00:00 2001 From: Ben Busby <33362396+benbusby@users.noreply.github.com> Date: Sun, 25 Oct 2020 21:32:18 -0400 Subject: [PATCH] Fix tor identity logic in Request.send --- app/request.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/request.py b/app/request.py index 0046984..c4d8f30 100644 --- a/app/request.py +++ b/app/request.py @@ -195,7 +195,8 @@ class Request: 'User-Agent': self.modified_user_agent } - if self.tor and not send_tor_signal(Signal.NEWNYM): # Request new identity if the last one failed + # Validate Tor connection and request new identity if the last one failed + if self.tor and not send_tor_signal(Signal.NEWNYM if attempt > 0 else Signal.HEARTBEAT): raise TorError("Tor was previously enabled, but the connection has been dropped. Please check your " + "Tor configuration and try again.", disable=True)