correctly close jingle session when no intersection between the remote codecs and the local ones. Fixes #8210

This commit is contained in:
Yann Leboulanger 2016-01-03 22:26:15 +01:00
parent 30aa143888
commit b672e23503
2 changed files with 14 additions and 4 deletions

View File

@ -36,6 +36,7 @@ from common import gajim
from common.jingle_transport import JingleTransportICEUDP
from common.jingle_content import contents, JingleContent, JingleContentSetupException
from common.connection_handlers_events import InformationEvent
from common.jingle_session import FailedApplication
import logging
@ -283,10 +284,10 @@ class JingleRTPContent(JingleContent):
codecs.append(c)
if codecs:
# FIXME: Handle this case:
# GLib.GError: There was no intersection between the remote codecs and
# the local ones
self.p2pstream.set_remote_codecs(codecs)
try:
self.p2pstream.set_remote_codecs(codecs)
except GLib.Error:
raise FailedApplication
def iter_codecs(self):
codecs = self.p2psession.props.codecs_without_config

View File

@ -59,6 +59,11 @@ class TieBreak(Exception):
action
"""
class FailedApplication(Exception):
"""
Exception that should be raised in case responder supports none of the payload-types offered by the initiator
"""
class JingleSession(object):
"""
This represents one jingle session, that is, one or more content types
@ -347,6 +352,10 @@ class JingleSession(object):
except OutOfOrder:
# FIXME
self.__send_error(stanza, 'unexpected-request', 'out-of-order')
except FailedApplication:
reason = nbxmpp.Node('reason')
reason.addChild('failed-application')
self._session_terminate(reason)
def __ack(self, stanza, jingle, error, action):
"""