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

calling TorClientEndpoint.connect() twice fails #245

Closed warner closed 4 years ago

warner commented 7 years ago

I've got a port-forwarding app which generates a single TorClientEndpoint for the target, then calls .connect() each time a client connects. This works the first time, but the second (and subsequent) call fails.

It turns out that TorClientEndpoint is replacing the list of potential SOCKS ports (socks_ports_to_try) with an iterator, in the constructor. So each call to .connect() will consume some members of this list, leaving no working ports for later calls.

I'll submit a PR that removes this iterator, leaving .connect() to just loop over the original list.

meejah commented 4 years ago

This was released some time ago it seems (please re-open if I'm wrong) way back in 0.20.0