[Twisted-Python] Conch SFTP Questions

Robert DiFalco robert.difalco at gmail.com
Thu Sep 24 12:42:54 MDT 2020


Here's a gist and here are my high level questions, I hope they make sense
and this is enough context.

https://gist.github.com/radifalco/5a5cca4bf8d49d5c61113e36f9be7553

1. I would expect a `makeDirectory` to raise an exception when the SSH
server closes a connection that is idle for too long (or any connection
error/issue). However, it appears like `makeConnection` never fires any
callbacks OR errbacks? In fact it doesn't seem to yield at all. It detects
the connection is closed, calls closed, but `makeDirectory` never has any
callbacks triggered. What am I missing? Is there a timeout I'm not setting?
I wouldn't think so since the FileTransferClient and underlying transport
already know the connection is no good.

https://gist.github.com/radifalco/5a5cca4bf8d49d5c61113e36f9be7553#file-sftp-py-L280-L297

2. I can't quite figure out the reconnect/retry logic when the server
closes the connection. Because when it recreates the connection the
SFTPFileTransferClient has already been sent to the deferred. Maybe I need
to retain that instance and call makeConnection on it again and not fire
the deferred? As you can see I tried that but it doesn't work.

On Wed, Sep 23, 2020 at 9:43 AM Glyph <glyph at twistedmatrix.com> wrote:

>
> On Sep 22, 2020, at 3:47 PM, Robert DiFalco <robert.difalco at gmail.com>
> wrote:
>
> Thanks! That is the full code. `connect` is from the conch library.
>
>
> To clarify Adi's comment somewhat, the "full" code would mean following
> the rules of http://sscce.org here; i.e. minimize the example to be
> runnable on its own, then attach the code as you actually run it (as a .py
> file, or in a link to a gist or a repo), rather than pasted into the body
> of the email which can easily lead to transcription errors.
>
> For example, when I do paste your code into a file and run it, what I get
> is:
>
> Traceback (most recent call last):
>   File "stuff.py", line 1, in <module>
>     @attr.s(frozen=True)
> NameError: name 'attr' is not defined
>
>
> and yeah, one could guess as to where to get `import attr`, from — me
> especially ;-) - but then we have to repeat that process for dozens of
> names, one at a time, gradually reassembling your code into something that
> approximates what it looked like to you; then we have to hook up your
> connection example to be runnable on its own, and after we're done guessing
> at all the imports we have to guess at the versions of things in your
> environment.  So a `requires.txt` generated by `pip freeze` or similar
> would also be a helpful addition here, just so someone attempting to tinker
> with your code can quickly get to the point rather than spending lots of
> time setting up things you've already done.
>
> Thanks for using Twisted, and good luck with Conch!
>
> -glyph
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20200924/a9638b60/attachment.htm>


More information about the Twisted-Python mailing list