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

Fix config value parsing issues #152

Closed coffeemakr closed 8 years ago

coffeemakr commented 8 years ago

Hi I noticed some bugs in the TorConfig:

>>> config.AllowSingleHopCircuits = True
>>> config.save() # Fails because tor expects 0 or 1 not "True"
>>> config = TorConfig(protocol)
>>> config.AllowSingleHopCircuits = 1
>>> config.save()
>>> config.AllowSingleHopCircuits
1
>>> config = TorConfig(protocol)
>>> config.AllowSingleHopCircuits
True
>>> config.AllowSingleHopCircuits = True
>>> config.save()
>>> config.AllowSingleHopCircuits
True
>>> # some time passes
...
>>> config.AllowSingleHopCircuits
'1'

I've made some changed and it seems to work for me but I don't know if you like the implementation.

Regards

codecov-io commented 8 years ago

Current coverage is 99.70%

Merging #152 into master will increase coverage by +0.01% as of 5c37ce3

@@            master   #152   diff @@
=====================================
  Files           15     15       
  Stmts         2659   2678    +19
  Branches         0      0       
  Methods          0      0       
=====================================
+ Hit           2651   2670    +19
  Partial          0      0       
  Missed           8      8       

Review entire Coverage Diff as of 5c37ce3

Powered by Codecov. Updated on successful CI builds.

meejah commented 8 years ago

Thanks, this looks really good!

I'll take a bit closer look at the diff and try it out locally before I merge. Also, you can feel free to put your own "note" in the docs/releases.rst file if you like for future pull-requests :) Except for the occasional "hot-fix" style release for particular bugs in older versions, generally "everything" goes into the next version.