[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Ensure created nicknames aren't too long



commit a3194c8a344af5a613dbc528805bd379c3f41cf0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Wed Jun 28 10:04:26 2017 -0700

    Ensure created nicknames aren't too long
    
    Jenkins tests are failing because the random nicknames we make are often too
    long. Ensuring that isn't the case.
---
 stem/descriptor/server_descriptor.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 580b3d3..8228b1d 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -806,8 +806,10 @@ class RelayDescriptor(ServerDescriptor):
     if attr is None:
       attr = {}
 
+    nickname = ('Unnamed%i' % random.randint(0, sys.maxint))[:19]
+
     base_header = (
-      ('router', 'Unnamed%i %s 9001 0 0' % (random.randint(0, sys.maxint), _random_ipv4_address())),
+      ('router', '%s %s 9001 0 0' % (nickname, _random_ipv4_address())),
       ('published', _random_date()),
       ('bandwidth', '153600 256000 104590'),
       ('reject', '*:*'),

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits