plugin pipe/stream, file transfert: refactoring and improvments:
this is a big patch as things had to be changed at the same time. - changed methods using profile argument to use client instead - move SatFile in a new tools.stream module, has it should be part of core, not a plugin - new IStreamProducer interface, to handler starting a pull producer - new FileStreamObject which create a stream producer/consumer from a SatFile - plugin pipe is no more using unix named pipe, as it complicate the thing, special care need to be taken to not block, and it's generally not necessary. Instead a socket is now used, so the plugin has been renomed to jingle stream. - bad connection/error should be better handler in jingle stream plugin, and code should not block anymore - jp pipe commands have been updated accordingly fix bug 237
This commit is contained in:
parent
ece10e8cd2
commit
60b8c8fa73
1 changed files with 870 additions and 670 deletions
|
|
@ -59,7 +59,7 @@ class XEP_0261(object):
|
|||
def getHandler(self, client):
|
||||
return XEP_0261_handler()
|
||||
|
||||
def jingleSessionInit(self, session, content_name, profile):
|
||||
def jingleSessionInit(self, client, session, content_name):
|
||||
transport_elt = domish.Element((NS_JINGLE_IBB, "transport"))
|
||||
content_data = session['contents'][content_name]
|
||||
transport_data = content_data['transport_data']
|
||||
|
|
@ -68,7 +68,7 @@ class XEP_0261(object):
|
|||
transport_elt['sid'] = transport_data['sid'] = unicode(uuid.uuid4())
|
||||
return transport_elt
|
||||
|
||||
def jingleHandler(self, action, session, content_name, transport_elt, profile):
|
||||
def jingleHandler(self, client, action, session, content_name, transport_elt):
|
||||
content_data = session['contents'][content_name]
|
||||
transport_data = content_data['transport_data']
|
||||
if action in (self._j.A_SESSION_ACCEPT,
|
||||
|
|
@ -80,13 +80,13 @@ class XEP_0261(object):
|
|||
elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER):
|
||||
peer_jid = session['peer_jid']
|
||||
sid = transport_data['sid']
|
||||
file_obj = content_data['file_obj']
|
||||
stream_object = content_data['stream_object']
|
||||
if action == self._j.A_START:
|
||||
block_size = transport_data['block_size']
|
||||
d = self._ibb.startStream(file_obj, peer_jid, sid, block_size, profile)
|
||||
d = self._ibb.startStream(client, stream_object, peer_jid, sid, block_size)
|
||||
d.chainDeferred(content_data['finished_d'])
|
||||
else:
|
||||
d = self._ibb.createSession(file_obj, peer_jid, sid, profile)
|
||||
d = self._ibb.createSession(client, stream_object, peer_jid, sid)
|
||||
d.chainDeferred(content_data['finished_d'])
|
||||
else:
|
||||
log.warning(u"FIXME: unmanaged action {}".format(action))
|
||||
|
|
|
|||
Loading…
Reference in a new issue