Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
50482f7c
Commit
50482f7c
authored
14 years ago
by
Thibg
Browse files
Options
Downloads
Patches
Plain Diff
[Jingle] Don't end the session on a content failure, only remove the content
parent
10554ff0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/jingle_rtp.py
+3
-2
3 additions, 2 deletions
src/common/jingle_rtp.py
src/common/jingle_session.py
+12
-11
12 additions, 11 deletions
src/common/jingle_session.py
with
15 additions
and
13 deletions
src/common/jingle_rtp.py
+
3
−
2
View file @
50482f7c
...
...
@@ -196,7 +196,7 @@ class JingleRTPContent(JingleContent):
if
state
==
farsight
.
STREAM_STATE_FAILED
:
reason
=
xmpp
.
Node
(
'
reason
'
)
reason
.
setTag
(
'
failed-transport
'
)
self
.
session
.
_session_terminate
(
reason
)
self
.
session
.
remove_content
(
self
.
creator
,
self
.
name
,
reason
)
elif
name
==
'
farsight-error
'
:
print
'
Farsight error #%d!
'
%
message
.
structure
[
'
error-no
'
]
print
'
Message: %s
'
%
message
.
structure
[
'
error-msg
'
]
...
...
@@ -217,6 +217,7 @@ class JingleRTPContent(JingleContent):
# Remove old source
self
.
src_bin
.
get_pad
(
'
src
'
).
unlink
(
sink_pad
)
self
.
src_bin
.
set_state
(
gst
.
STATE_NULL
)
self
.
pipeline
.
remove
(
self
.
src_bin
)
if
not
self
.
stream_failed_once
:
...
...
@@ -229,7 +230,7 @@ class JingleRTPContent(JingleContent):
# TODO: remove content, don't kill session
reason
=
xmpp
.
Node
(
'
reason
'
)
reason
.
setTag
(
'
failed-application
'
)
self
.
session
.
_session_terminate
(
reason
)
self
.
session
.
remove_content
(
self
.
creator
,
self
.
name
,
reason
)
# Start playing again
self
.
pipeline
.
set_state
(
gst
.
STATE_PLAYING
)
...
...
This diff is collapsed.
Click to expand it.
src/common/jingle_session.py
+
12
−
11
View file @
50482f7c
...
...
@@ -184,17 +184,18 @@ class JingleSession(object):
# The content is from us, accept it
content
.
accepted
=
True
def
remove_content
(
self
,
creator
,
name
):
def
remove_content
(
self
,
creator
,
name
,
reason
=
None
):
"""
We do not need this now
Remove the content `name` created by `creator`
by sending content-remove, or by sending session-terminate if
there is no content left.
"""
#TODO:
if
(
creator
,
name
)
in
self
.
contents
:
content
=
self
.
contents
[(
creator
,
name
)]
if
len
(
self
.
contents
)
>
1
:
self
.
__content_remove
(
content
)
self
.
__content_remove
(
content
,
reason
)
self
.
contents
[(
creator
,
name
)].
destroy
()
if
len
(
self
.
contents
)
==
0
:
if
not
self
.
contents
:
self
.
end_session
()
def
modify_content
(
self
,
creator
,
name
,
*
someother
):
...
...
@@ -549,7 +550,7 @@ class JingleSession(object):
break
return
(
reason
,
text
)
def
__make_jingle
(
self
,
action
):
def
__make_jingle
(
self
,
action
,
reason
=
None
):
stanza
=
xmpp
.
Iq
(
typ
=
'
set
'
,
to
=
xmpp
.
JID
(
self
.
peerjid
))
attrs
=
{
'
action
'
:
action
,
'
sid
'
:
self
.
sid
}
...
...
@@ -558,6 +559,8 @@ class JingleSession(object):
elif
action
==
'
session-accept
'
:
attrs
[
'
responder
'
]
=
self
.
responder
jingle
=
stanza
.
addChild
(
'
jingle
'
,
attrs
=
attrs
,
namespace
=
xmpp
.
NS_JINGLE
)
if
reason
is
not
None
:
jingle
.
addChild
(
node
=
reason
)
return
stanza
,
jingle
def
__send_error
(
self
,
stanza
,
error
,
jingle_error
=
None
,
text
=
None
,
type_
=
None
):
...
...
@@ -614,9 +617,7 @@ class JingleSession(object):
def
_session_terminate
(
self
,
reason
=
None
):
assert
self
.
state
!=
JingleStates
.
ended
stanza
,
jingle
=
self
.
__make_jingle
(
'
session-terminate
'
)
if
reason
is
not
None
:
jingle
.
addChild
(
node
=
reason
)
stanza
,
jingle
=
self
.
__make_jingle
(
'
session-terminate
'
,
reason
=
reason
)
self
.
__broadcast_all
(
stanza
,
jingle
,
None
,
'
session-terminate-sent
'
)
self
.
connection
.
connection
.
send
(
stanza
)
# TODO: Move to GUI?
...
...
@@ -659,9 +660,9 @@ class JingleSession(object):
def
__content_modify
(
self
):
assert
self
.
state
!=
JingleStates
.
ended
def
__content_remove
(
self
,
content
):
def
__content_remove
(
self
,
content
,
reason
=
None
):
assert
self
.
state
!=
JingleStates
.
ended
stanza
,
jingle
=
self
.
__make_jingle
(
'
content-remove
'
)
stanza
,
jingle
=
self
.
__make_jingle
(
'
content-remove
'
,
reason
=
reason
)
self
.
__append_content
(
jingle
,
content
)
self
.
connection
.
connection
.
send
(
stanza
)
# TODO: this will fail if content is not an RTP content
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment