commit a4aa5e7d5e7b72caf1a545b0b26e43ffe2946dfc Author: juga0 juga@riseup.net Date: Wed Feb 6 17:16:39 2019 +0000
circuitbuilder: return reasons on circuit build errors --- sbws/lib/circuitbuilder.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py index be10c2b..95e670a 100644 --- a/sbws/lib/circuitbuilder.py +++ b/sbws/lib/circuitbuilder.py @@ -136,16 +136,13 @@ class GapsCircuitBuilder(CircuitBuilder): return None, "Can not build a circuit, invalid path." path = self._normalize_path(path) if path is None: - return None + return None, "Can not build a circuit, no path." num_missing = len(['foo' for r in path if not r]) insert_relays = self._random_sample_relays( num_missing, [r for r in path if r is not None]) if insert_relays is None: path = ','.join([r.nickname if r else str(None) for r in path]) - log.warning( - 'Problem building a circuit to satisfy %s with available ' - 'relays in the network', path) - return None + return None, "Can not build a circuit with the current relays." assert len(insert_relays) == num_missing path = [r.fingerprint if r else insert_relays.pop().fingerprint for r in path]