[telepathy-gabble/master] Reduce spurious transport-infos
Will Thompson
will.thompson at collabora.co.uk
Mon Jun 22 09:39:44 PDT 2009
Gabble sometimes sent an empty transport-info after session-initiate,
and always retransmitted all its candidates after session-accept. This
had the same root cause. The intention here was to tell the transport
that session-initiate had been sent and so the queued candidates can be
sent, but since TRUE was passed to
gabble_jingle_transport_iface_retransmit_candidates (), they were all
resent.
Also, transport-info stanzas were sent even if they contained no
candidates; transmit_candidates () now short-circuits if that is the
case.
---
src/jingle-content.c | 6 ++++--
src/jingle-content.h | 3 ++-
src/jingle-session.c | 7 ++++---
src/jingle-transport-google.c | 10 +++++++---
4 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/jingle-content.c b/src/jingle-content.c
index 08dacf5..9bbae08 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -889,9 +889,11 @@ gabble_jingle_content_maybe_send_description (GabbleJingleContent *self)
* candidates), and when we detect gtalk3 after we've transmitted some
* candidates. */
void
-gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self)
+gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self,
+ gboolean all)
{
- gabble_jingle_transport_iface_retransmit_candidates (self->priv->transport, TRUE);
+ gabble_jingle_transport_iface_retransmit_candidates (self->priv->transport,
+ all);
}
/* Called by a subclass when the media is ready (e.g. we got local codecs) */
diff --git a/src/jingle-content.h b/src/jingle-content.h
index a65f407..28f5de8 100644
--- a/src/jingle-content.h
+++ b/src/jingle-content.h
@@ -120,7 +120,8 @@ void gabble_jingle_content_remove (GabbleJingleContent *c, gboolean signal_peer)
GList *gabble_jingle_content_get_remote_candidates (GabbleJingleContent *c);
gboolean gabble_jingle_content_change_direction (GabbleJingleContent *c,
JingleContentSenders senders);
-void gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self);
+void gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self,
+ gboolean all);
gboolean gabble_jingle_content_is_created_by_us (GabbleJingleContent *c);
gboolean gabble_jingle_content_creator_is_initiator (GabbleJingleContent *c);
diff --git a/src/jingle-session.c b/src/jingle-session.c
index f4dd25f..aaafa80 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -1315,7 +1315,7 @@ on_transport_info (GabbleJingleSession *sess, LmMessageNode *node,
{
DEBUG ("switching to gtalk3 dialect and retransmiting our candidates");
priv->dialect = JINGLE_DIALECT_GTALK3;
- gabble_jingle_content_retransmit_candidates (c);
+ gabble_jingle_content_retransmit_candidates (c, TRUE);
}
else
{
@@ -1646,9 +1646,10 @@ _check_content_ready (GabbleJingleSession *sess,
static void
_transmit_candidates (GabbleJingleSession *sess,
- GabbleJingleContent *c, gpointer user_data)
+ GabbleJingleContent *c,
+ gpointer user_data)
{
- gabble_jingle_content_retransmit_candidates (c);
+ gabble_jingle_content_retransmit_candidates (c, FALSE);
}
static void
diff --git a/src/jingle-transport-google.c b/src/jingle-transport-google.c
index 26abc96..e2afbeb 100644
--- a/src/jingle-transport-google.c
+++ b/src/jingle-transport-google.c
@@ -406,6 +406,9 @@ transmit_candidates (GabbleJingleTransportGoogle *transport,
LmMessage *msg;
LmMessageNode *trans_node, *sess_node;
+ if (candidates == NULL)
+ return;
+
msg = gabble_jingle_session_new_message (priv->content->session,
JINGLE_ACTION_TRANSPORT_INFO, &sess_node);
@@ -564,9 +567,10 @@ retransmit_candidates (GabbleJingleTransportIface *obj, gboolean all)
}
else
{
- /* in case content was ready after we wanted to transmit
- * them originally, we are called to retranmit them */
- if (priv->pending_candidates != NULL) {
+ /* If the content became ready after we wanted to transmit
+ * these originally, we are called to transmit when it them */
+ if (priv->pending_candidates != NULL)
+ {
group_and_transmit_candidates (transport, priv->pending_candidates);
priv->pending_candidates = NULL;
}
--
1.5.6.5
More information about the telepathy-commits
mailing list