[Twisted-Python] conch defer for dataReceived
Alexey Panyovin
a at runtel.ru
Wed Jul 29 03:09:23 MDT 2015
Thans You!
I found same solution, but to another problem like this.
Channel class:
class SFTPChannel(channel.SSHChannel):
name ='session' _sftp = defer.Deferred()
# defer = def channelOpen(self, _):d =self.conn.sendRequest(self, 'subsystem', common.NS('sftp'), wantReply=True)
self.conn.sftp_channel_defer = d.addCallbacks(self._cbSFTP)@defer.inlineCallbacks def _cbSFTP(self, result):self.client = FileTransferClient()
self.client.makeConnection(self)
self.dataReceived =self.client.dataReceived
self._sftp.callback(self.client)
def get_file(self, *args): print args
Use in exteral module m = connection.sftp_channel._sftp.addCallback(connection.sftp_channel.get_file, *['./222/test.txt', '/root/freeswitch_37_17.tar'])
m.addCallback(self._cbFileRCopy)
m.addErrback(self._ebFileRCopy)
I think, if set some defer in SSHChannel in
def channelOpen(self, data): self.conn.sendRequest(self, 'exec',
common.NS(self.command), wantReply=True).addCallback(self._gotResponse)
self._chennel_defer = Defered()
and in
def dataReceived(self, data): self._chennel_defer = some_def()
But in this case one channel = one command = one respons 29.07.15 11:56,
Glyph пишет:
>> On Jul 28, 2015, at 10:02 PM, Alexey Panyovin <a at runtel.ru
>> <mailto:a at runtel.ru>> wrote:
>> I'm use self made queue for my task. I'll try to amp. Thanks glyph!
> Good luck Alexey! Thanks for using Twisted!
> Please feel free to ask any more questions you have about using AMP.
> -glyph
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20150729/3fc5b46a/attachment-0002.html>
More information about the Twisted-Python
mailing list