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

karsten at torproject.org karsten at torproject.org
Thu Mar 31 08:27:02 UTC 2011


commit b445b050801cb085e80cd8111b4ba0ad2d5739f3
Author: Karsten Loesing <karsten.loesing at gmx.net>
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__':



More information about the tor-commits mailing list