Patch: make TnyCamelSendQueue queue-stop signal be sent after processing all sent signals
- From: Jose Dapena Paz <jdapena igalia com>
- To: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Patch: make TnyCamelSendQueue queue-stop signal be sent after processing all sent signals
- Date: Thu, 21 Feb 2008 11:55:24 +0100
Hi,
This patch forces send queue to wait until all the msg-sent signals
have been processed, before it emits the queue stop signal.
Changelog entry:
2008-02-21 Jose Dapena Paz <jdapena igalia com>
* libtinymail-camel/tny-camel-send-queue-priv.h,
libtinymail-camel/tny-camel-send-queue.c:
Now we don't send the run-queue-stop signal until
we've processed all sent signals.
--
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: libtinymail-camel/tny-camel-send-queue-priv.h
===================================================================
--- libtinymail-camel/tny-camel-send-queue-priv.h (revision 3423)
+++ libtinymail-camel/tny-camel-send-queue-priv.h (working copy)
@@ -35,6 +35,7 @@
GMutex *todo_lock, *sending_lock;
gboolean do_continue, is_running;
gboolean observer_attached;
+ gint pending_send_notifies;
};
#endif
Index: libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- libtinymail-camel/tny-camel-send-queue.c (revision 3423)
+++ libtinymail-camel/tny-camel-send-queue.c (working copy)
@@ -71,6 +71,8 @@
} ControlInfo;
+static void emit_queue_control_signals (TnySendQueue *self, guint signal_id);
+
static TnyFolder*
get_sentbox (TnySendQueue *self)
{
@@ -234,6 +236,11 @@
g_object_unref (header);
}
+ priv->pending_send_notifies--;
+ if (priv->pending_send_notifies == 0 && priv->thread == NULL) {
+ emit_queue_control_signals (self, TNY_SEND_QUEUE_STOP);
+ }
+
g_object_unref (self);
}
@@ -263,7 +270,9 @@
iter = tny_list_create_iterator (list);
while (!tny_iterator_is_done (iter))
{
+ TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self);
TnyHeader *cur = TNY_HEADER (tny_iterator_get_current (iter));
+ priv->pending_send_notifies++;
tny_folder_get_msg_async (sentbox, cur,
on_msg_sent_get_msg, on_status,
g_object_ref (self));
@@ -289,6 +298,8 @@
TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (info->self);
TnyCamelAccountPriv *apriv = NULL;
+ if ((priv->pending_send_notifies > 0) && (info->signal_id == TNY_SEND_QUEUE_STOP))
+ return FALSE;
if (priv && priv->trans_account)
apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account);
if (apriv)
@@ -1134,6 +1145,7 @@
priv->sending_lock = g_mutex_new ();
priv->is_running = FALSE;
priv->thread = NULL;
+ priv->pending_send_notifies = 0;
return;
}
Index: ChangeLog
===================================================================
--- ChangeLog (revision 3423)
+++ ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2008-02-21 Jose Dapena Paz <jdapena igalia com>
+
+ * libtinymail-camel/tny-camel-send-queue-priv.h,
+ libtinymail-camel/tny-camel-send-queue.c:
+ Now we don't send the run-queue-stop signal until
+ we've processed all sent signals.
+
+
2008-02-20 Philip Van Hoof <pvanhoof gnome org>
* Improvement for cancel's their reconnection
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]