evolution-rss r129 - trunk/src
- From: lucilanga svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-rss r129 - trunk/src
- Date: Fri, 25 Jan 2008 10:41:32 +0000 (GMT)
Author: lucilanga
Date: Fri Jan 25 10:41:32 2008
New Revision: 129
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=129&view=rev
Log:
abort soup
Modified:
trunk/src/network-soup.c
trunk/src/rss.c
trunk/src/rss.h
Modified: trunk/src/network-soup.c
==============================================================================
--- trunk/src/network-soup.c (original)
+++ trunk/src/network-soup.c Fri Jan 25 10:41:32 2008
@@ -116,21 +116,31 @@
return FALSE;
}
+void
+construct_abort(gpointer key, gpointer value, gpointer user_data)
+{
+ g_hash_table_insert(rf->abort_session, key, value);
+}
+
static void
unblock_free (gpointer user_data, GObject *ex_msg)
{
+ g_print("weak ref - trying to free object\n");
#ifdef RSS_DEBUG
g_print("weak ref - trying to free object\n");
#endif
+ g_hash_table_remove(rf->session, user_data);
+ g_hash_table_destroy(rf->abort_session);
+ rf->abort_session = g_hash_table_new(g_direct_hash, g_direct_equal);
+ g_hash_table_foreach(rf->session, construct_abort, NULL);
+ g_hash_table_find(rf->key_session,
+ remove_if_match,
+ user_data);
gboolean prune = soup_session_try_prune_connection (user_data);
//I really don't know if his is necesarry
//but I believe it won't hurt
if (prune)
g_object_unref(user_data);
-// g_hash_table_remove(rf->session, user_data);
- g_hash_table_find(rf->key_session,
- remove_if_match,
- user_data);
}
//this will insert proxy in the session
@@ -340,6 +350,8 @@
info->total = 0;
if (!rf->session)
rf->session = g_hash_table_new(g_direct_hash, g_direct_equal);
+ if (!rf->abort_session)
+ rf->abort_session = g_hash_table_new(g_direct_hash, g_direct_equal);
if (!rf->key_session)
rf->key_session = g_hash_table_new(g_direct_hash, g_direct_equal);
@@ -357,6 +369,7 @@
return -1;
}
g_hash_table_insert(rf->session, soup_sess, msg);
+ g_hash_table_insert(rf->abort_session, soup_sess, msg);
g_hash_table_insert(rf->key_session, data, soup_sess);
gchar *agstr = g_strdup_printf("Evolution/%s; Evolution-RSS/%s",
@@ -373,6 +386,7 @@
g_object_add_weak_pointer (G_OBJECT(msg), (gpointer)info);
g_object_weak_ref (G_OBJECT(msg), unblock_free, soup_sess);
+// g_object_weak_ref (G_OBJECT(soup_sess), unblock_free, soup_sess);
// GMainLoop *mainloop = g_main_loop_new (g_main_context_default (), FALSE);
// g_timeout_add (10 * 1000, &conn_mainloop_quit, mainloop);
return 1;
Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c (original)
+++ trunk/src/rss.c Fri Jan 25 10:41:32 2008
@@ -965,21 +965,27 @@
soup_session_cancel_message(key, value);
}
soup_session_abort(key);
- g_hash_table_find(rf->key_session,
+/* g_hash_table_find(rf->key_session,
remove_if_match,
- user_data);
+ user_data);*/
}
g_print(" key:%p, value:%p\n", key, value);
return TRUE;
}
+void
+remove_weak(gpointer key, gpointer value, gpointer user_data)
+{
+ g_object_weak_unref(value, unblock_free, key);
+}
void
abort_all_soup(void)
{
//abort all session
- if (rf->session)
+ if (rf->abort_session)
{
- g_hash_table_foreach_remove(rf->session, cancel_soup_sess, NULL);
+ g_hash_table_foreach(rf->abort_session, remove_weak, NULL);
+ g_hash_table_foreach_remove(rf->abort_session, cancel_soup_sess, NULL);
}
if (rf->progress_bar)
{
@@ -3534,6 +3540,7 @@
if (!key)
deleted = 1;
+ g_print("feed %s\n", user_data);
if (rf->feed_queue)
rf->feed_queue--;
Modified: trunk/src/rss.h
==============================================================================
--- trunk/src/rss.h (original)
+++ trunk/src/rss.h Fri Jan 25 10:41:32 2008
@@ -83,6 +83,8 @@
guint feed_queue;
gboolean cancel; //cancelation signal
GHashTable *session; //queue of active unblocking sessions
+ GHashTable *abort_session; //this is a hack to be able to iterate when
+ //we remove keys from seesion with weak_ref
GHashTable *key_session; //queue of active unblocking sessions and keys linked
SoupSession *b_session; //active blocking session
SoupMessage *b_msg_session; //message running in the blocking session
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]