[telepathy-gabble/master] Don't confuse disco waiters from different resources

Will Thompson will.thompson at collabora.co.uk
Thu Sep 10 05:50:11 PDT 2009


I think doing so is probably harmless, but it's better to be explicit
---
 src/presence-cache.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/presence-cache.c b/src/presence-cache.c
index 71c7166..5a9e420 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -912,7 +912,8 @@ disco_failed (GabblePresenceCache *cache,
 
 static DiscoWaiter *
 find_matching_waiter (GSList *waiters,
-    TpHandle handle)
+    TpHandle godot,
+    const gchar *resource)
 {
   GSList *i;
 
@@ -920,7 +921,7 @@ find_matching_waiter (GSList *waiters,
     {
       DiscoWaiter *waiter = i->data;
 
-      if (waiter->handle == handle)
+      if (waiter->handle == godot && !tp_strdiff (waiter->resource, resource))
         return waiter;
     }
 
@@ -1032,6 +1033,7 @@ _caps_disco_cb (GabbleDisco *disco,
   TpHandle handle = 0;
   gboolean bad_hash = FALSE;
   TpBaseConnection *base_conn;
+  gchar *resource;
 
   cache = GABBLE_PRESENCE_CACHE (user_data);
   priv = GABBLE_PRESENCE_CACHE_PRIV (cache);
@@ -1064,11 +1066,14 @@ _caps_disco_cb (GabbleDisco *disco,
       return;
     }
 
-  waiter_self = find_matching_waiter (waiters, handle);
+  /* If tp_handle_ensure () was happy with the jid, it's valid. */
+  g_assert (gabble_decode_jid (jid, NULL, NULL, &resource));
+  waiter_self = find_matching_waiter (waiters, handle, resource);
+  g_free (resource);
 
   if (NULL == waiter_self)
     {
-      DEBUG ("Ignoring non requested disco reply");
+      DEBUG ("Ignoring non requested disco reply from %s", jid);
       goto OUT;
     }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list