meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

all_routers disappearing after NEWCONSENSUS? #203

Closed meejah closed 7 years ago

meejah commented 7 years ago

It seems in latest txtorcon that the all_routers list in TorState becomes empty after a NEWCONSENSUS. Needs investigation.

meejah commented 7 years ago

This does appear to be true, and I have a (small) fix but I still don't understand the actual problem exactly :/

meejah commented 7 years ago

Early-return problem in https://github.com/meejah/txtorcon/commit/f2a18c6c7da68df76112723d67de67c8c5a26fd0

evilaliv3 commented 7 years ago

thank you @meejah for fixing this so proactively!

i was just about to open this ticket and fix with the same patch :)

a good suggestion for all users of previous versions is to use state.routers.values() instead of state.all_routers().

this in the real could be an alternative that you could evaluate instead of keeping an additional list, it has a minor overhead due to the .values() call at runtime but due to the size of the object is really a minor thing.