summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-02-19 18:48:37 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-02-19 18:48:37 +0000
commit9565ce08c927a6b2c38698a8e9cb16cf394f0084 (patch)
tree02935556a10aa10a25810bd62af9bbcf7aa1efe3
parente3921d8c6cfd8f1d4015eef85ab97af8dee78c93 (diff)
GabblePresenceCache: re-order signal emission vs. removal of pending requests
This fixes the following situation, which is difficult to test in the regression tests without making them take even longer: * the global "unsure period" for the presence cache has finished (5 seconds) * we call a peer whose presence we do not have * we ask that peer to decloak * they do so, and give us a capabilities hash we don't already know about * we send them a disco request to work out what it means * they reply to the disco request Previously, we'd signal to the media channel that it should proceed with the delayed request, but because the node (caps hash) was still in our table of pending disco requests, when the media channel asked whether the presence cache was sure about the contact's capabilities yet, the presence cache would reply that it was not, because it was waiting for a disco request. In the regression tests, this was masked by the fact that the global "unsure period" had not finished. When it does, the media channel sees this as another opportunity to retry pending calls, and by then, the presence cache *does* consider itself to be sure about that contact.
-rw-r--r--src/presence-cache.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/presence-cache.c b/src/presence-cache.c
index 9d04888fd..2b32969cd 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -1215,6 +1215,13 @@ _caps_disco_cb (GabbleDisco *disco,
if (trust >= CAPABILITY_BUNDLE_ENOUGH_TRUST)
{
+ /* Remove the node from the hash table without freeing it. This needs
+ * to be done before emitting the signal, so that when recipients of
+ * the capabilities-discovered signal ask whether we're unsure about
+ * the handle, there is no pending disco request that would make us
+ * unsure. */
+ g_hash_table_steal (priv->disco_pending, node);
+
/* We trust this caps node. Serve all its waiters. */
for (i = waiters; NULL != i; i = i->next)
{
@@ -1224,7 +1231,7 @@ _caps_disco_cb (GabbleDisco *disco,
emit_capabilities_discovered (cache, waiter->handle);
}
- g_hash_table_remove (priv->disco_pending, node);
+ disco_waiter_list_free (waiters);
}
else
{