[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] Status report - Stream-RTT



On Monday 05 August 2013 07:25:20 Damian Johnson wrote:
> Yup. It's unfortunate that tor decided to include an 'Exit' flag with
> such an unintuitive meaning. You're not the first person to be
> confused by it.

Is this meaning at least documented somewhere and I have just read over it?

> > -) It is not safe to use extend_circuit in parallel for creating new
> > circuits. I think this is not mentioned anywhere.
> 
> What kind of issue does that encounter? Is it a problem with stem's
> thread safety or an issue on tor's side?

If requests are sent to Tor to create more then a single circuit at once, the 
mapping between circuit events and create-request is unknown because the 
circuit ID is not known until the LAUNCHED-event has been received.
This is clearly an issue on Tor's side but one could argue that Stem should 
stop me from using it that way.

> Manual lock handling is risky. If anything within this block raises an
> exception (and there's several points throughout your script where you
> use Controller methods that can potentially raise errors) then the
> lock won't be released.
> 
> The safer way of doing this is to use the 'with' keyword...

I could get rid of all manual locking besides in one case.

> Not necessary. Methods return None by default.

Removed.

> You might want to look into pyflakes and pep8. I've found them to be
> better static analysis tools.

pyflakes didn't say anything but I commited lots of cosmetic pep8 changes .

> > try:
> >   controller = connect_port()
> > 
> > except SocketError:
> >   sys.stderr.write("ERROR: Couldn't connect to Tor.\n")
> >   sys.exit(1)
> > 
> > controller.authenticate()
> 
> Not quite. The connect_port() function never returns an exception.
> Rather, if it fails to establish a control connection then it prints
> the issue to stdout and returns None. Also, the connection it provides
> is already authenticated.

If Tor has ControlPort enabled without having HashedControlPassword set, 
authenticate() has to be called to authenticate the connection.
Though this is not recommended I don't know which other default setting would 
be more appropriate.

> This should instead be...
> 
> controller = connect_port()
> 
> if not controller:
>   sys.exit(1)  # failed to get a control connenction

Fixed.

Best,
Robert

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev