[telepathy-gabble/telepathy-gabble-0.8] vcard-manager.c: Move the timer arming in cache_entry_ensure_queued()

Alban Crequy alban.crequy at collabora.co.uk
Fri Sep 25 10:08:12 PDT 2009


It will fixed the timers override (problem found during Daf's review)
---
 src/vcard-manager.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index 08556b7..d03f25c 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -1046,10 +1046,6 @@ suspended_request_timeout_cb (gpointer data)
 {
   GabbleVCardManagerRequest *request = data;
 
-  g_assert (request->timer_id == 0);
-  request->timer_id =
-      g_timeout_add_seconds (request->timeout, timeout_request, request);
-
   /* Send the request again */
   request->entry->suspended_timer_id = 0;
   cache_entry_ensure_queued (request, request->timeout);
@@ -1185,6 +1181,8 @@ cache_entry_ensure_queued (GabbleVCardManagerRequest *request, guint timeout)
   TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base,
       TP_HANDLE_TYPE_CONTACT);
 
+  g_assert (request->timer_id == 0);
+
   if (entry->pipeline_item)
     {
       DEBUG ("adding to cache entry %p with <iq> already pending", entry);
@@ -1198,6 +1196,9 @@ cache_entry_ensure_queued (GabbleVCardManagerRequest *request, guint timeout)
       const char *jid;
       LmMessage *msg;
 
+      request->timer_id =
+          g_timeout_add_seconds (request->timeout, timeout_request, request);
+
       if (entry->handle == base->self_handle)
         {
           DEBUG ("Cache entry %p is my own, not setting @to", entry);
@@ -1267,8 +1268,6 @@ gabble_vcard_manager_request (GabbleVCardManager *self,
   request->entry->pending_requests = g_slist_prepend
       (request->entry->pending_requests, request);
 
-  request->timer_id =
-      g_timeout_add_seconds (timeout, timeout_request, request);
   cache_entry_ensure_queued (request, timeout);
   return request;
 }
-- 
1.5.6.5




More information about the telepathy-commits mailing list