Mercurial > pidgin.yaz
changeset 26187:836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 05 Feb 2009 23:30:48 +0000 |
parents | d780894d7022 |
children | 9cda61a15698 |
files | libpurple/protocols/jabber/jingle/rtp.c |
diffstat | 1 files changed, 28 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rtp.c Thu Feb 05 22:30:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Thu Feb 05 23:30:48 2009 +0000 @@ -295,6 +295,25 @@ } static void +jingle_rtp_initiate_ack_cb(JabberStream *js, xmlnode *packet, gpointer data) +{ + JingleSession *session = data; + + if (!strcmp(xmlnode_get_attrib(packet, "type"), "error") || + xmlnode_get_child(packet, "error")) { + gchar *sid = jingle_session_get_sid(session); + purple_media_end(jingle_rtp_get_media(session), NULL, NULL); + g_hash_table_remove(jingle_session_get_js( + session)->medias, sid); + g_free(sid); + return; + } + + jabber_iq_send(jingle_session_to_packet(session, + JINGLE_TRANSPORT_INFO)); +} + +static void jingle_rtp_ready_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session) { purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name); @@ -302,16 +321,18 @@ if (sid == NULL && name == NULL) { if (jingle_session_is_initiator(session) == TRUE) { GList *contents = jingle_session_get_contents(session); - - jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE)); + JabberIq *iq = jingle_session_to_packet( + session, JINGLE_SESSION_INITIATE); - for (; contents; contents = g_list_next(contents)) { - JingleContent *content = (JingleContent *)contents->data; - JingleTransport *transport = jingle_content_get_transport(content); + if (contents->data) { + JingleTransport *transport = + jingle_content_get_transport(contents->data); if (JINGLE_IS_ICEUDP(transport)) - jabber_iq_send(jingle_session_to_packet(session, - JINGLE_TRANSPORT_INFO)); + jabber_iq_set_callback(iq, + jingle_rtp_initiate_ack_cb, session); } + + jabber_iq_send(iq); } else { jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO)); jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT));