This PR primarily refactors how connections are made to the Tor control port. The code now uses the Txtorcon high-level interfaces to either run a new Tor daemon or to connect to a running Tor (txtorcon.launch and txtorcon.connect respectively). Both the unit tests and main tool now use the same Tor connection interface.
Tor configuration options are now applied via the Txtorcon TorConfig object which handles marking changed options and applying the changes all at one. There was an issue when setting the UseMicroDescriptors option as this would cause Tor to throw away its descriptors and request new ones. As a result the tests would fail when they were run before all the descriptors were received.
The fix was to wait for a NEWCONSENSUS event after changing an option that required a consensus be loaded.
This PR also fixes some other small issues and renames the self.tor TorState object to self.tor_state to make the code more clear.
Coverage increased (+3.5%) to 54.748% when pulling 78b0c8cf7ab472ef08fa7d6f3cfa2429c39e2f7c on tor-conn-fixes into ff86b302ff1c1ef395b9e38f60775be9e9217f94 on develop.
This PR primarily refactors how connections are made to the Tor control port. The code now uses the
Txtorcon
high-level interfaces to either run a new Tor daemon or to connect to a running Tor (txtorcon.launch
andtxtorcon.connect
respectively). Both the unit tests and main tool now use the same Tor connection interface.Tor configuration options are now applied via the Txtorcon
TorConfig
object which handles marking changed options and applying the changes all at one. There was an issue when setting theUseMicroDescriptors
option as this would cause Tor to throw away its descriptors and request new ones. As a result the tests would fail when they were run before all the descriptors were received.The fix was to wait for a
NEWCONSENSUS
event after changing an option that required a consensus be loaded.This PR also fixes some other small issues and renames the
self.tor
TorState object toself.tor_state
to make the code more clear.