Commit b445b050 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Instantiate listener before registering events.

This patch avoids a race condition that occurred in 2 out of 16 cases.
parent 17182144
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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__':