Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make launch() check for ControlPort status in a more robust way #226

Open
hellais opened this issue Apr 17, 2017 · 4 comments
Open

make launch() check for ControlPort status in a more robust way #226

hellais opened this issue Apr 17, 2017 · 4 comments

Comments

@hellais
Copy link
Contributor

hellais commented Apr 17, 2017

As documented in https://github.com/meejah/txtorcon/blob/master/txtorcon/controller.py#L131, it seems like txtorcon checks simply for the first bootstrapping line to learn if the control port is open, it seems like this is actually a bit fragile and sometimes leads to problems.

It would be better if instead it looked for the line:

Apr 16 18:39:46.600 [notice] Opening Control listener on 127.0.0.1:9051

or

Feb 14 14:21:46.828 [notice] Opening Control listener on /home/f/tor-browser_en-US/Browser/TorBrowser/Data/Tor/control.socket
@meejah meejah added this to the v1.0.0 milestone Apr 17, 2017
@meejah
Copy link
Owner

meejah commented Apr 21, 2017

👍 this sounds like a great idea.

Also probably fairly easy, great for anyone looking for a "first txtorcon PR".

@KyleRConway
Copy link

@meejah -- I'm looking for a "first txtorcon PR" -- would love to work on this one.

@meejah
Copy link
Owner

meejah commented Oct 5, 2018

Hi @KyleRConway, great!

If you use IRC, the best way to real-time chat with me is to join the #tor-dev channel on the OFTC network (I'm "meejah" there). Or we can just use this ticket to communicate if that's easier.

launch() starts here: https://github.com/meejah/txtorcon/blob/master/txtorcon/controller.py#L53 -- it's kind of long, but the interesting part will actually be in TorProcessProtocol (https://github.com/meejah/txtorcon/blob/master/txtorcon/controller.py#L1221) and outReceived. This is where any output from the Tor process will be received. Currently, it just waits for any output right now. For this ticket, we should buffer (some of) the received lines and look for "Opening control listener" or similar before trying the connections.

@meejah
Copy link
Owner

meejah commented Oct 5, 2018

If you don't know Twisted or async programming and want to learn more about that aspect, this is a great tutorial: http://krondo.com/an-introduction-to-asynchronous-programming-and-twisted/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants