plugins XEP-0234, XEP-0260, XEP-0261: jingle session termination is managed by application (XEP-0234) instead of transport
This commit is contained in:
parent
728e15c90c
commit
af953d89a9
1 changed files with 51 additions and 33 deletions
|
|
@ -221,9 +221,17 @@ class XEP_0260(object):
|
|||
if choosed_candidate is None:
|
||||
log.warning(u"Socks5 negociation failed, we need to fallback to IBB")
|
||||
else:
|
||||
# best_peer_candidate was choosed from the candidates we have sent
|
||||
# so our_candidate is true if choosed_candidate is peer_best_candidate
|
||||
our_candidate = choosed_candidate==peer_best_candidate
|
||||
if choosed_candidate == peer_best_candidate:
|
||||
# peer_best_candidate was choosed from the candidates we have sent
|
||||
# so our_candidate is true if choosed_candidate is peer_best_candidate
|
||||
our_candidate = True
|
||||
# than also mean that best_candidate must be discarded !
|
||||
try:
|
||||
best_candidate.discard()
|
||||
except AttributeError: # but it can be None
|
||||
pass
|
||||
else:
|
||||
our_candidate = False
|
||||
|
||||
log.info(u"Socks5 negociation successful, {who} candidate will be used: {candidate}".format(
|
||||
who = u'our' if our_candidate else u'other peer',
|
||||
|
|
@ -326,8 +334,7 @@ class XEP_0260(object):
|
|||
peer_candidates = transport_data['peer_candidates']
|
||||
file_obj = content_data['file_obj']
|
||||
stream_d = self._s5b.registerHash(session_hash, file_obj, profile)
|
||||
args = [session, content_name, profile]
|
||||
stream_d.addCallbacks(self._streamCb, self._streamEb, args, None, args)
|
||||
stream_d.chainDeferred(content_data['finished_d'])
|
||||
d = self._s5b.getBestCandidate(peer_candidates, session_hash, profile)
|
||||
d.addCallback(self._foundPeerCandidate, session, transport_data, content_name, client)
|
||||
|
||||
|
|
@ -340,8 +347,7 @@ class XEP_0260(object):
|
|||
peer_candidates = transport_data['peer_candidates'] = self._parseCandidates(transport_elt)
|
||||
file_obj = content_data['file_obj']
|
||||
stream_d = self._s5b.registerHash(session_hash, file_obj, profile)
|
||||
args = [session, content_name, profile]
|
||||
stream_d.addCallbacks(self._streamCb, self._streamEb, args, None, args)
|
||||
stream_d.chainDeferred(content_data['finished_d'])
|
||||
d = self._s5b.getBestCandidate(peer_candidates, session_hash, profile)
|
||||
d.addCallback(self._foundPeerCandidate, session, transport_data, content_name, client)
|
||||
candidates = yield self._s5b.getCandidates(profile)
|
||||
|
|
@ -375,13 +381,6 @@ class XEP_0260(object):
|
|||
|
||||
defer.returnValue(transport_elt)
|
||||
|
||||
def _streamCb(self, dummy, session, content_name, profile):
|
||||
self._j.contentTerminate(session, content_name, profile=profile)
|
||||
|
||||
def _streamEb(self, failure, session, content_name, profile):
|
||||
log.warning(u"Error while streaming through s5b: {}".format(failure))
|
||||
self._j.contentTerminate(session, content_name, reason=self._j.REASON_FAILED_TRANSPORT, profile=profile)
|
||||
|
||||
|
||||
class XEP_0260_handler(XMPPHandler):
|
||||
implements(iwokkel.IDisco)
|
||||
|
|
|
|||
Loading…
Reference in a new issue