Closed warner closed 7 years ago
Cool, thanks!
I made a pull-request from my 245-multiple-connect
to yours improving a test that sort-of did this but didn't actually get through the whole list (nor check re-using the endpoint).
@warner please see https://github.com/meejah/txtorcon/pull/249
I think StreamClientEndpoints should be reusable: you should be able to call .connect() multiple times, yielding a different Protocol instance each time. But the TorClientEndpoint constructor creates a single iterator to track the sequence of possible SOCKS ports we should try, so the second time .connect() is called, it uses the next item on this list, which will fail.
This patch removes the iterator and just loops over the original list each time .connect() is called, removing the interaction between calls.
This ought to fix #245. I wasn't able to figure out a good unit test for it.. if you can point me in the right direction, I'll add a test and re-submit the PR.