[tor-commits] [sbws/master] circuitbuilder: stop getting a circuit to close it.

juga at torproject.org juga at torproject.org
Mon Feb 4 14:57:14 UTC 2019


commit ff5e7d6b522cc5ecf822ef05b2439aadda803c11
Author: juga0 <juga at riseup.net>
Date:   Tue Jan 8 14:41:18 2019 +0000

    circuitbuilder: stop getting a circuit to close it.
    
    If the circuit no longer exists, the exception is already catched.
---
 sbws/lib/circuitbuilder.py | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index aa70156..396f238 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -56,17 +56,12 @@ class CircuitBuilder:
         raise NotImplementedError()
 
     def close_circuit(self, circ_id):
-        c = self.controller
         try:
-            c.get_circuit(circ_id, default=None)
-            try:
-                c.close_circuit(circ_id)
-            # SocketClosed will be raised when stopping sbws
-            except (InvalidArguments, InvalidRequest, SocketClosed) as e:
-                log.debug(e)
-            self.built_circuits.discard(circ_id)
-        except (ControllerError, ValueError) as e:
-            log.exception("Error trying to get circuit to close it: %s.", e)
+            self.controller.close_circuit(circ_id)
+        # SocketClosed will be raised when stopping sbws
+        except (InvalidArguments, InvalidRequest, SocketClosed) as e:
+            log.debug(e)
+        self.built_circuits.discard(circ_id)
 
     def _build_circuit_impl(self, path):
         """





More information about the tor-commits mailing list