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,
Post by GlyphI'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
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python