[telepathy-gabble/telepathy-gabble-0.8] vCard replay timer is set to 3 seconds for the unit tests

Alban Crequy alban.crequy at collabora.co.uk
Thu Sep 24 10:04:27 PDT 2009


---
 src/vcard-manager.c        |   15 +++++++++++----
 src/vcard-manager.h        |    3 +++
 tests/twisted/main-debug.c |    3 +++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index 1b9f145..fc59728 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -41,9 +41,9 @@
 #define VCARD_CACHE_ENTRY_TTL 60
 
 /* When the server reply with XMPP_ERROR_RESOURCE_CONSTRAINT, wait
- * REQUEST_WAIT_DELAY seconds before allowing a vCard request to be sent to
+ * request_wait_delay seconds before allowing a vCard request to be sent to
  * the same recipient */
-#define REQUEST_WAIT_DELAY (5 * 60)
+static guint request_wait_delay = 5 * 60;
 
 static const gchar *NO_ALIAS = "none";
 
@@ -152,7 +152,7 @@ struct _GabbleVCardCacheEntry
   GSList *pending_requests;
 
   /* When requests for this entry receive an error of type "wait", we suspend
-   * further requests and retry again after REQUEST_WAIT_DELAY seconds.
+   * further requests and retry again after request_wait_delay seconds.
    * 0 if not suspended.
    */
   guint suspended_timer_id;
@@ -1100,7 +1100,7 @@ pipeline_reply_cb (GabbleConnection *conn,
           XMPP_ERROR_RESOURCE_CONSTRAINT && error_type == XMPP_ERROR_TYPE_WAIT)
         {
           entry->suspended_timer_id = g_timeout_add_seconds (
-              REQUEST_WAIT_DELAY, suspended_request_timeout_cb, request);
+              request_wait_delay, suspended_request_timeout_cb, request);
           return;
         }
 
@@ -1479,3 +1479,10 @@ gabble_vcard_manager_has_cached_alias (GabbleVCardManager *self,
 
   return p != NULL;
 }
+
+/* For unit tests only */
+void
+gabble_vcard_manager_set_suspend_reply_timeout (guint timeout)
+{
+  request_wait_delay = timeout;
+}
diff --git a/src/vcard-manager.h b/src/vcard-manager.h
index b7e9d0a..0d35223 100644
--- a/src/vcard-manager.h
+++ b/src/vcard-manager.h
@@ -126,6 +126,9 @@ GabbleVCardManagerEditRequest *gabble_vcard_manager_edit (GabbleVCardManager *,
 
 void gabble_vcard_manager_remove_edit_request (GabbleVCardManagerEditRequest *);
 
+/* For unit tests only */
+void gabble_vcard_manager_set_suspend_reply_timeout (guint timeout);
+
 G_END_DECLS
 
 #endif
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 95c8958..953f5c0 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -19,6 +19,7 @@
 
 #include "gabble.h"
 #include "connection.h"
+#include "vcard-manager.h"
 #include "jingle-factory.h"
 #include "jingle-session.h"
 
@@ -34,6 +35,8 @@ main (int argc,
 
   /* needed for test-disco-no-reply.py */
   gabble_connection_set_disco_reply_timeout (3);
+  /* needed for test-avatar-async.py */
+  gabble_vcard_manager_set_suspend_reply_timeout (3);
 
   gibber_resolver_set_resolver (GABBLE_TYPE_RESOLVER_FAKE);
   gabble_jingle_factory_set_test_mode ();
-- 
1.5.6.5




More information about the telepathy-commits mailing list