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

[tor-commits] [torperf/master] Instantiate listener before registering events.



commit b445b050801cb085e80cd8111b4ba0ad2d5739f3
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Mar 31 09:54:28 2011 +0200

    Instantiate listener before registering events.
    
    This patch avoids a race condition that occurred in 2 out of 16 cases.
---
 entrycons.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/entrycons.py b/entrycons.py
index d1c8f34..fb89f1f 100755
--- a/entrycons.py
+++ b/entrycons.py
@@ -120,11 +120,11 @@ def main():
 
   conn = TorCtl.connect(HOST, port)
 
-  conn.set_events(["NEWCONSENSUS", "NEWDESC", "NS", "GUARD"])
   conn.set_option("StrictEntryNodes", "1")
   conn.set_option("UseEntryNodes", "1")
 
   EntryTracker(conn, speed)
+  conn.set_events(["NEWCONSENSUS", "NEWDESC", "NS", "GUARD"])
   conn.block_until_close()
 
 if __name__ == '__main__':

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