Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0261.py @ 1571:c668081eba1c
plugins XEP-0234, XEP-0260, XEP-0261: jingle session termination is managed by application (XEP-0234) instead of transport
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 08 Nov 2015 14:48:04 +0100 |
parents | 268fda4236ca |
children | 25906c0dbc63 |
comparison
equal
deleted
inserted
replaced
1570:37d4be4a9fed | 1571:c668081eba1c |
---|---|
75 transport_data['sid'] = transport_elt['sid'] | 75 transport_data['sid'] = transport_elt['sid'] |
76 elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER): | 76 elif action in (self._j.A_START, self._j.A_PREPARE_RESPONDER): |
77 peer_jid = session['peer_jid'] | 77 peer_jid = session['peer_jid'] |
78 sid = transport_data['sid'] | 78 sid = transport_data['sid'] |
79 file_obj = content_data['file_obj'] | 79 file_obj = content_data['file_obj'] |
80 args = [session, content_name, profile] | |
81 if action == self._j.A_START: | 80 if action == self._j.A_START: |
82 block_size = transport_data['block_size'] | 81 block_size = transport_data['block_size'] |
83 d = self._ibb.startStream(file_obj, peer_jid, sid, block_size, profile) | 82 d = self._ibb.startStream(file_obj, peer_jid, sid, block_size, profile) |
84 d.addErrback(self._streamEb, *args) | 83 d.chainDeferred(content_data['finished_d']) |
85 else: | 84 else: |
86 d = self._ibb.createSession(file_obj, peer_jid, sid, profile) | 85 d = self._ibb.createSession(file_obj, peer_jid, sid, profile) |
87 d.addCallbacks(self._streamCb, self._streamEb, args, None, args) | 86 d.chainDeferred(content_data['finished_d']) |
88 else: | 87 else: |
89 log.warning(u"FIXME: unmanaged action {}".format(action)) | 88 log.warning(u"FIXME: unmanaged action {}".format(action)) |
90 return transport_elt | 89 return transport_elt |
91 | 90 |
92 def _streamCb(self, dummy, session, content_name, profile): | |
93 self._j.contentTerminate(session, content_name, profile=profile) | |
94 | |
95 def _streamEb(self, failure, session, content_name, profile): | |
96 log.warning(u"Error while streaming in-band: {}".format(failure)) | |
97 self._j.contentTerminate(session, content_name, reason=self._j.REASON_FAILED_TRANSPORT, profile=profile) | |
98 | 91 |
99 class XEP_0261_handler(XMPPHandler): | 92 class XEP_0261_handler(XMPPHandler): |
100 implements(iwokkel.IDisco) | 93 implements(iwokkel.IDisco) |
101 | 94 |
102 def getDiscoInfo(self, requestor, target, nodeIdentifier=''): | 95 def getDiscoInfo(self, requestor, target, nodeIdentifier=''): |