[evolution-rss] use proxify async in dowload functions too
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] use proxify async in dowload functions too
- Date: Thu, 17 Mar 2011 20:14:10 +0000 (UTC)
commit 254351b8088b8034210528fd06daa326d5be8e18
Author: Lucian Langa <lucilanga gnome org>
Date: Thu Mar 17 22:13:36 2011 +0200
use proxify async in dowload functions too
src/network-soup.c | 48 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 35 insertions(+), 13 deletions(-)
---
diff --git a/src/network-soup.c b/src/network-soup.c
index f14e045..d323768 100644
--- a/src/network-soup.c
+++ b/src/network-soup.c
@@ -65,6 +65,8 @@ typedef struct {
SoupSession *ss;
} CallbackInfo;
+typedef void (*pCallback)(gpointer data);
+
typedef struct {
SoupSession *ss;
SoupMessage *sm;
@@ -73,8 +75,12 @@ typedef struct {
gchar *url;
gchar *host;
SoupAddress *addr;
+ pCallback callback;
+ gpointer data;
} STNET;
+void idle_callback(gpointer data);
+void queue_callback(gpointer data);
void proxify_session_async(EProxy *proxy, STNET *stnet);
static void rss_webkit_resolve_callback (SoupAddress *addr, guint status, gpointer data);
@@ -342,8 +348,7 @@ rss_resolve_callback (SoupAddress *addr, guint status, gpointer data)
G_OBJECT (stnet->ss),
SOUP_SESSION_PROXY_URI,
proxy_uri, NULL);
- soup_session_queue_message (stnet->ss, stnet->sm,
- stnet->cb2, stnet->cbdata2);
+ stnet->callback(stnet->data);
}
static void
@@ -373,6 +378,14 @@ rss_webkit_resolve_callback (SoupAddress *addr, guint status, gpointer data)
wknet->cb(wknet->str, wknet->base, wknet->encoding);
}
+void
+queue_callback(gpointer data)
+{
+ STNET *stnet = (STNET *)data;
+ soup_session_queue_message (stnet->ss, stnet->sm,
+ stnet->cb2, stnet->cbdata2);
+}
+
//this will insert proxy in the session
//and queue the message to be sent
void
@@ -429,9 +442,8 @@ proxify_session_async(EProxy *proxy, STNET *stnet)
#endif
}
-out: soup_session_queue_message (stnet->ss, stnet->sm,
- stnet->cb2, stnet->cbdata2);
-
+out: stnet->callback(stnet->data);
+ //free stnet
}
guint
@@ -827,6 +839,8 @@ net_get_unblocking(gchar *url,
stnet->cb2 = cb2;
stnet->cbdata2 = cbdata2;
stnet->url = g_strdup(url);
+ stnet->callback = queue_callback;
+ stnet->data = stnet;
proxify_session_async(proxy, stnet);
//free stnet
@@ -839,6 +853,17 @@ net_get_unblocking(gchar *url,
return TRUE;
}
+void
+idle_callback(gpointer data)
+{
+ STNET *stnet = (STNET *)data;
+ g_queue_push_tail (rf->stqueue, stnet);
+ rf->enclist = g_list_append (rf->enclist, stnet->url);
+
+ if (!net_qid)
+ net_qid = g_idle_add((GSourceFunc)net_queue_dispatcher, NULL);
+}
+
// same stuff as net_get_* but without accumulating headers
// push all donwloads to a customizable length queue
gboolean
@@ -867,9 +892,6 @@ download_unblocking(
}
#endif
-#if (DATASERVER_VERSION >= 2023001)
- proxify_session(proxy, soup_sess, url);
-#endif
if (cb && data) {
info = g_new0(CallbackInfo, 1);
info->user_cb = cb;
@@ -928,15 +950,15 @@ download_unblocking(
stnet->sm = msg;
stnet->cb2 = cb2;
stnet->cbdata2 = cbdata2;
- stnet->url = g_strdup(url);
-
-
- g_queue_push_tail (rf->stqueue, stnet);
- rf->enclist = g_list_append (rf->enclist, url);
+ stnet->url = url;
+ stnet->callback = idle_callback;
+ stnet->data = stnet;
if (!net_qid)
net_qid = g_idle_add((GSourceFunc)net_queue_dispatcher, NULL);
+ stnet->callback(stnet->data);
+
//// 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]