On 01:31 pm, donald@stufft.io wrote:
On Oct 2, 2013, at 9:20 AM, exarkun@twistedmatrix.com wrote:
On 01:21 am, donald@stufft.io wrote:
I have two pieces of code (see: https://gist.github.com/dstufft/9dc9978dc0af77e82f0c) one "works" (in that it fails verifying the host key like i'd expect) and one doesn't ("it never tries to verify the host key and just exists immediately).
I don't understand *why* though, why does the connectionReady dance make it work?
Where's the second piece of code?
Jean-Paul
Both are in the gist, works.py and fails.py
Oops, sorry. The second one disappeared when I clicked the "raw" link I guess. In the first version, you `react` until `connectProtocol`'s Deferred fires. That's immediately upon the TCP connection setup success - before any appreciable SSH happens. In the second version, you `react` indefinitely (because `connectionReady` never fires) giving SSH ample time to handshake. BTW, I'm not sure what you plan to do with this connection, but if you haven't seen `twisted.conch.endpoints` (and <https://tm.tl/6617>) then you probably want to look. Jean-Paul