[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] fix: relayprioritizer: number of prioritized relays
commit 4fa29b025ea353a8cb55a2e81298c092297a3287
Author: juga0 <juga@xxxxxxxxxx>
Date: Fri Mar 22 09:17:42 2019 +0000
fix: relayprioritizer: number of prioritized relays
The number of prioritized relays was set to the minimum, but in a
small testing network this could be lesser than the number of
relays in the network.
---
sbws/lib/relayprioritizer.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sbws/lib/relayprioritizer.py b/sbws/lib/relayprioritizer.py
index bb64b06..4932ea8 100644
--- a/sbws/lib/relayprioritizer.py
+++ b/sbws/lib/relayprioritizer.py
@@ -143,7 +143,9 @@ class RelayPrioritizer:
# Increment the number of times ``best_priority`` has been run.
self.increment_priority_lists()
# Increment the number of relays that have been "prioritized".
- self.increment_priority_relays(upper_limit)
+ # Because in a small testing network the upper limit could be smaller
+ # than the number of relays in the network, use the length of the list.
+ self.increment_priority_relays(len(relays[0:upper_limit]))
for relay in relays[0:upper_limit]:
log.debug('Returning next relay %s with priority %f',
relay.nickname, relay.priority)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits