pidgin: a3cbe3e1: Gracefully handle failures to create an ...
maiku at pidgin.im
maiku at pidgin.im
Fri Aug 21 23:00:48 EDT 2009
-----------------------------------------------------------------
Revision: a3cbe3e11bc3bb7a4c1ecd17011d62ffba9abedf
Ancestor: 09828caa4a3333f2f0eed91315c29d5b3aa66fcb
Author: maiku at pidgin.im
Date: 2009-08-22T02:55:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a3cbe3e11bc3bb7a4c1ecd17011d62ffba9abedf
Modified files:
libpurple/media.c libpurple/protocols/jabber/google.c
ChangeLog:
Gracefully handle failures to create an FsStream. This was caused by
Farsight 2's new "tos" property which isn't defaulting to 0 properly on some
systems. This won't make calls on systems that are affected by this bug #10017
work, but it won't crash now. Fixes #10016
-------------- next part --------------
============================================================
--- libpurple/media.c f80265c25454966119d7be3f03c07556ce2033eb
+++ libpurple/media.c 0cf0c321ba31ca2d29f7f73ed136fe6d040ca56e
@@ -2730,10 +2730,13 @@ purple_media_add_stream(PurpleMedia *med
num_params, params, &err);
}
- if (err) {
- purple_debug_error("media", "Error creating stream: %s\n",
- err->message);
- g_error_free(err);
+ if (fsstream == NULL) {
+ purple_debug_error("media",
+ "Error creating stream: %s\n",
+ err && err->message ?
+ err->message : "NULL");
+ if (err)
+ g_error_free(err);
g_object_unref(participant);
g_hash_table_remove(media->priv->participants, who);
purple_media_remove_session(media, session);
============================================================
--- libpurple/protocols/jabber/google.c 96b7fe9831a293b540f1fbc4362e9358f3e6274e
+++ libpurple/protocols/jabber/google.c 5c4c306297c1b9a6a1b4c86636600dbe41d6c568
@@ -91,20 +91,6 @@ static void
}
static void
-google_session_send_terminate(GoogleSession *session)
-{
- xmlnode *sess;
- JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
-
- xmlnode_set_attrib(iq->node, "to", session->remote_jid);
- sess = google_session_create_xmlnode(session, "terminate");
- xmlnode_insert_child(iq->node, sess);
-
- jabber_iq_send(iq);
- google_session_destroy(session);
-}
-
-static void
google_session_send_candidates(PurpleMedia *media, gchar *session_id,
gchar *participant, GoogleSession *session)
{
@@ -398,6 +384,16 @@ jabber_google_session_initiate(JabberStr
purple_media_set_prpl_data(session->media, session);
+ g_signal_connect_swapped(G_OBJECT(session->media),
+ "candidates-prepared",
+ G_CALLBACK(google_session_ready), session);
+ g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed",
+ G_CALLBACK(google_session_ready), session);
+ g_signal_connect(G_OBJECT(session->media), "state-changed",
+ G_CALLBACK(google_session_state_changed_cb), session);
+ g_signal_connect(G_OBJECT(session->media), "stream-info",
+ G_CALLBACK(google_session_stream_info_cb), session);
+
params = jabber_google_session_get_params(js, &num_params);
if (purple_media_add_stream(session->media, "google-voice",
@@ -408,23 +404,11 @@ jabber_google_session_initiate(JabberStr
session->remote_jid, PURPLE_MEDIA_VIDEO,
TRUE, "nice", num_params, params) == FALSE)) {
purple_media_error(session->media, "Error adding stream.");
- purple_media_stream_info(session->media,
- PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE);
- google_session_destroy(session);
+ purple_media_end(session->media, NULL, NULL);
g_free(params);
return FALSE;
}
- g_signal_connect_swapped(G_OBJECT(session->media),
- "candidates-prepared",
- G_CALLBACK(google_session_ready), session);
- g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed",
- G_CALLBACK(google_session_ready), session);
- g_signal_connect(G_OBJECT(session->media), "state-changed",
- G_CALLBACK(google_session_state_changed_cb), session);
- g_signal_connect(G_OBJECT(session->media), "stream-info",
- G_CALLBACK(google_session_stream_info_cb), session);
-
g_free(params);
return (session->media != NULL) ? TRUE : FALSE;
@@ -466,6 +450,16 @@ google_session_handle_initiate(JabberStr
purple_media_set_prpl_data(session->media, session);
+ g_signal_connect_swapped(G_OBJECT(session->media),
+ "candidates-prepared",
+ G_CALLBACK(google_session_ready), session);
+ g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed",
+ G_CALLBACK(google_session_ready), session);
+ g_signal_connect(G_OBJECT(session->media), "state-changed",
+ G_CALLBACK(google_session_state_changed_cb), session);
+ g_signal_connect(G_OBJECT(session->media), "stream-info",
+ G_CALLBACK(google_session_stream_info_cb), session);
+
params = jabber_google_session_get_params(js, &num_params);
if (purple_media_add_stream(session->media, "google-voice",
@@ -477,8 +471,7 @@ google_session_handle_initiate(JabberStr
FALSE, "nice", num_params, params) == FALSE)) {
purple_media_error(session->media, "Error adding stream.");
purple_media_stream_info(session->media,
- PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE);
- google_session_send_terminate(session);
+ PURPLE_MEDIA_INFO_REJECT, NULL, NULL, TRUE);
g_free(params);
return FALSE;
}
@@ -535,18 +528,6 @@ google_session_handle_initiate(JabberStr
purple_media_codec_list_free(codecs);
purple_media_codec_list_free(video_codecs);
- g_signal_connect_swapped(G_OBJECT(session->media), "accepted",
- G_CALLBACK(google_session_ready), session);
- g_signal_connect_swapped(G_OBJECT(session->media),
- "candidates-prepared",
- G_CALLBACK(google_session_ready), session);
- g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed",
- G_CALLBACK(google_session_ready), session);
- g_signal_connect(G_OBJECT(session->media), "state-changed",
- G_CALLBACK(google_session_state_changed_cb), session);
- g_signal_connect(G_OBJECT(session->media), "stream-info",
- G_CALLBACK(google_session_stream_info_cb), session);
-
result = jabber_iq_new(js, JABBER_IQ_RESULT);
jabber_iq_set_id(result, iq_id);
xmlnode_set_attrib(result->node, "to", session->remote_jid);
@@ -778,8 +759,7 @@ jabber_google_session_parse(JabberStream
session->js = js;
session->remote_jid = g_strdup(session->id.initiator);
- if (!google_session_handle_initiate(js, session, session_node, iq_id))
- google_session_destroy(session);
+ google_session_handle_initiate(js, session, session_node, iq_id);
}
#endif /* USE_VV */
More information about the Commits
mailing list