[Twisted-Python] Conch channel blocked

Kuba Konczyk jakamkon at gmail.com
Thu Feb 4 09:30:59 MST 2010


2010/2/4 james bardin <jbardin at bu.edu>:
> On Thu, Feb 4, 2010 at 9:01 AM,  <exarkun at twistedmatrix.com> wrote:
>>
>> I can't run your example code, since it's not a complete example.  That
>> makes it harder to point out what's wrong with it.  However, one thing
>> does strike me as wrong:
>>>        while chunk:
>>>            self.write(chunk)
>>>            chunk = f.read(4096)
>>
>> This is a pattern you typically want to avoid, in Conch or anything else
>> Twisted-based.  I don't know if SSHChannel is a consumer, but if not it
>> should be, and you should be writing the file using a producer.  See:
>>
>
> It looked awkward, but the one example in the documentation was my
> only starting point.
> http://twistedmatrix.com/documents/current/conch/howto/conch_client.html
>
> This is only a slightly modified version of that example, which writes
> directly through the session channel, which makes sense in the
> ssh-protocol, but apparently not here.
>
>
>> http://twistedmatrix.com/documents/current/core/howto/producers.html
>>>
>
> Thanks. I'll see if I can relate that into conch.
>
>>>Does anyone know if any projects making good use of twisted.conch,
>>>where I can see the source in action, and in depth?
>>
>> Mantissa uses Twisted Conch a bit:
>>
>> http://divmod.org/trac/browser/trunk/Mantissa/xmantissa/terminal.py
>>
>> But you won't find any code sending any exec requests there.
>>
>
> That's OK. any little bit helps.
> I have a twisted service, and it needs to tunnel some information
> through an ssh channel. Although this would take me a couple minutes
> with another library, I feel I should be able to make use of what's
> already built in to twisted, and not add another dependency.
Maybe you can use connection forwarding in conch? Have a look at
http://twistedmatrix.com/trac/browser/trunk/twisted/conch/scripts/conch.py
to see how the forwarding API works.

Kuba
>
> -jim
>




More information about the Twisted-Python mailing list