[telepathy-gabble/master] remove timeouts from Jingle session initiation and content adding
Dafydd Harries
dafydd.harries at collabora.co.uk
Mon Aug 3 11:01:20 PDT 2009
A timeout on making a call should be client policy. I'm not sure what the
content add timeout was meant to achieve.
---
src/jingle-content.c | 18 -------
src/jingle-session.c | 40 --------------
src/jingle-session.h | 3 -
tests/twisted/Makefile.am | 1 -
tests/twisted/jingle/outgoing-not-answered.py | 69 -------------------------
tests/twisted/main-debug.c | 2 -
6 files changed, 0 insertions(+), 133 deletions(-)
delete mode 100644 tests/twisted/jingle/outgoing-not-answered.py
diff --git a/src/jingle-content.c b/src/jingle-content.c
index 55d109d..f1be177 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -82,7 +82,6 @@ struct _GabbleJingleContentPrivate
/* Whether we have at least one local candidate. */
gboolean have_local_candidates;
- guint timer_id;
guint gtalk4_event_id;
gboolean dispose_has_run;
@@ -787,19 +786,6 @@ gabble_jingle_content_is_ready (GabbleJingleContent *self)
return FALSE;
}
-static gboolean
-timeout_content (gpointer data)
-{
- GabbleJingleContent *c = data;
-
- c->priv->timer_id = 0;
- DEBUG ("content timed out");
-
- /* we're handling it as if it were rejected */
- gabble_jingle_content_remove (c, FALSE);
- return FALSE;
-}
-
static void
send_content_add_or_accept (GabbleJingleContent *self)
{
@@ -816,10 +802,6 @@ send_content_add_or_accept (GabbleJingleContent *self)
/* TODO: set a timer for acknowledgement */
action = JINGLE_ACTION_CONTENT_ADD;
new_state = JINGLE_CONTENT_STATE_SENT;
-
- g_assert (priv->timer_id == 0);
- priv->timer_id = g_timeout_add (DEFAULT_CONTENT_TIMEOUT,
- timeout_content, self);
}
else
{
diff --git a/src/jingle-session.c b/src/jingle-session.c
index f2bf713..b27a660 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -96,13 +96,9 @@ struct _GabbleJingleSessionPrivate
gboolean remote_hold;
gboolean remote_ringing;
- guint timer_id;
-
gboolean dispose_has_run;
};
-static guint session_timeout_time = 60000;
-
typedef struct {
JingleState state;
JingleAction *actions;
@@ -189,7 +185,6 @@ gabble_jingle_session_init (GabbleJingleSession *obj)
priv->state = JS_STATE_PENDING_CREATED;
priv->locally_accepted = FALSE;
priv->locally_terminated = FALSE;
- priv->timer_id = 0;
priv->dispose_has_run = FALSE;
}
@@ -209,7 +204,6 @@ gabble_jingle_session_dispose (GObject *object)
g_assert ((priv->state == JS_STATE_PENDING_CREATED) ||
(priv->state == JS_STATE_ENDED));
- g_assert (priv->timer_id == 0);
g_hash_table_destroy (priv->initiator_contents);
priv->initiator_contents = NULL;
@@ -1786,19 +1780,6 @@ _on_accept_reply (GObject *sess_as_obj,
}
}
-static gboolean
-timeout_session (gpointer data)
-{
- GabbleJingleSession *session = data;
-
- DEBUG ("session timed out");
- session->priv->timer_id = 0;
-
- gabble_jingle_session_terminate (session,
- TP_CHANNEL_GROUP_CHANGE_REASON_NO_ANSWER, NULL);
- return FALSE;
-}
-
static void
try_session_initiate_or_accept (GabbleJingleSession *sess)
{
@@ -1926,21 +1907,6 @@ set_state (GabbleJingleSession *sess,
state < JS_STATE_ENDED)
gabble_jingle_session_send_held (sess);
- /* if we or peer just initiated the session, set the session timer */
- if ((priv->local_initiator && (state == JS_STATE_PENDING_INITIATE_SENT)) ||
- (!priv->local_initiator && (state == JS_STATE_PENDING_INITIATED)))
- {
- g_assert (priv->timer_id == 0);
- priv->timer_id = g_timeout_add (session_timeout_time,
- timeout_session, sess);
- }
- /* if we're active or ended, we can clear the timer */
- else if ((state >= JS_STATE_ACTIVE) && (priv->timer_id != 0))
- {
- g_source_remove (priv->timer_id);
- priv->timer_id = 0;
- }
-
if (state == JS_STATE_ENDED)
g_signal_emit (sess, signals[TERMINATED], 0, priv->locally_terminated,
termination_reason);
@@ -2278,9 +2244,3 @@ gabble_jingle_session_get_dialect (GabbleJingleSession *sess)
return sess->priv->dialect;
}
-/* Only to be used for the test suite */
-void
-gabble_set_jingle_session_timeout (guint ms)
-{
- session_timeout_time = ms;
-}
diff --git a/src/jingle-session.h b/src/jingle-session.h
index 7903be7..5c25eb4 100644
--- a/src/jingle-session.h
+++ b/src/jingle-session.h
@@ -129,8 +129,5 @@ gboolean gabble_jingle_session_get_remote_ringing (GabbleJingleSession *sess);
gboolean gabble_jingle_session_defines_action (GabbleJingleSession *sess,
JingleAction action);
-/* Only to be used for the test suite */
-void gabble_set_jingle_session_timeout (guint seconds);
-
#endif /* __JINGLE_SESSION_H__ */
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 4e8b9b0..e097f72 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -95,7 +95,6 @@ TWISTED_TESTS = \
jingle/outgoing-basics.py \
jingle/outgoing-ensure.py \
jingle/outgoing-many-streams.py \
- jingle/outgoing-not-answered.py \
jingle/payload-types.py \
jingle/preload-caps-crash.py \
jingle/stream-handler-error.py \
diff --git a/tests/twisted/jingle/outgoing-not-answered.py b/tests/twisted/jingle/outgoing-not-answered.py
deleted file mode 100644
index 4bd3b49..0000000
--- a/tests/twisted/jingle/outgoing-not-answered.py
+++ /dev/null
@@ -1,69 +0,0 @@
-"""
-Tests outgoing calls timing out if they're not answered.
-"""
-
-from twisted.words.xish import xpath
-
-from servicetest import make_channel_proxy, EventPattern, sync_dbus
-from jingletest2 import JingleTest2, test_all_dialects
-
-import constants as cs
-
-def test(jp, q, bus, conn, stream):
- remote_jid = 'daf at example.com/misc'
- jt = JingleTest2(jp, conn, q, stream, 'test at localhost', remote_jid)
-
- jt.prepare()
-
- self_handle = conn.GetSelfHandle()
- remote_handle = conn.RequestHandles(cs.HT_CONTACT, [remote_jid])[0]
- path, _ = conn.Requests.CreateChannel({
- cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
- cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
- cs.TARGET_HANDLE: remote_handle})
- media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
- media_iface.RequestStreams(remote_handle, [cs.MEDIA_STREAM_TYPE_AUDIO])
-
- e = q.expect('dbus-signal', signal='NewSessionHandler')
- assert e.args[1] == 'rtp'
- session_handler = make_channel_proxy(conn, e.args[0], 'Media.SessionHandler')
- session_handler.Ready()
-
- e = q.expect('dbus-signal', signal='NewStreamHandler')
- stream_handler = make_channel_proxy(conn, e.args[0], 'Media.StreamHandler')
- stream_handler.NewNativeCandidate("fake", jt.get_remote_transports_dbus())
- stream_handler.Ready(jt.get_audio_codecs_dbus())
- stream_handler.StreamState(cs.MEDIA_STREAM_STATE_CONNECTED)
-
- q.expect('stream-iq', predicate=jp.action_predicate('session-initiate'))
-
- # Ensure we've got all the MembersChanged signals at the start of the call
- # out of the way.
- sync_dbus(bus, q, conn)
-
- # daf doesn't answer; we expect the call to end.
- mc, t = q.expect_many(
- EventPattern('dbus-signal', signal='MembersChanged'),
- EventPattern('stream-iq',
- predicate=jp.action_predicate('session-terminate')),
- )
-
- _, added, removed, lp, rp, actor, reason = mc.args
- assert added == [], added
- assert set(removed) == set([self_handle, remote_handle]), \
- (removed, self_handle, remote_handle)
- assert lp == [], lp
- assert rp == [], rp
- # It's not clear whether the actor should be self_handle (we gave up),
- # remote_handle (the other guy didn't pick up), or neither. So I'll make no
- # assertions.
- assert reason == cs.GC_REASON_NO_ANSWER, reason
-
- if jp.dialect == 'jingle-v0.31':
- # Check we sent <reason><timeout/></reason> to daf
- jingle = t.query
- assert xpath.queryForNodes("/jingle/reason/timeout", jingle) is not None, \
- jingle.toXml()
-
-if __name__ == '__main__':
- test_all_dialects(test)
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 618a8c9..2de68e2 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -35,8 +35,6 @@ main (int argc,
/* needed for test-disco-no-reply.py */
gabble_connection_set_disco_reply_timeout (3000);
- gabble_set_jingle_session_timeout (1500);
-
gibber_resolver_set_resolver (GABBLE_TYPE_RESOLVER_FAKE);
gabble_jingle_factory_set_test_mode ();
--
1.5.6.5
More information about the telepathy-commits
mailing list