On Sat, Dec 06, 2008 at 03:33:44AM +0100, slush wrote: > More high-level, my problem is, that I dont know StreamID *before* I create > stream by calling socket.connect(), but it never finish, because of > deadlock. Is there any possibility to get stream id before this call or do > this call non-blocking?
Sounds like you either want to 1) use multiple threads (one to do the connect, and one to listen to Tor controller events and assign the stream to the circuit) or to 2) make your connect non-blocking and then listen to controller events and assign the stream to the circuit and then go back to see if the connect() has finished. I think the more usual approach is #1. (There is no way to learn the streamid before starting the connect(), since there is no stream, so Tor hasn't picked a number for it yet.) --Roger