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

Alban Crequy alban.crequy at collabora.co.uk
Thu Oct 8 07:49:20 PDT 2009


---
 src/vcard-manager.c        |   12 +++++++++---
 src/vcard-manager.h        |    1 +
 tests/twisted/main-debug.c |    1 +
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index e155c7f..c93332d 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -37,7 +37,7 @@
 #include "request-pipeline.h"
 #include "util.h"
 
-#define DEFAULT_REQUEST_TIMEOUT 180
+static guint default_request_timeout = 180;
 #define VCARD_CACHE_ENTRY_TTL 60
 
 /* When the server reply with XMPP_ERROR_RESOURCE_CONSTRAINT, wait
@@ -1031,7 +1031,7 @@ manager_patch_vcard (GabbleVCardManager *self,
   priv->patched_vcard = lm_message_node_ref (patched_vcard);
 
   priv->edit_pipeline_item = gabble_request_pipeline_enqueue (
-      priv->connection->req_pipeline, msg, DEFAULT_REQUEST_TIMEOUT,
+      priv->connection->req_pipeline, msg, default_request_timeout,
       replace_reply_cb, self);
 
   lm_message_unref (msg);
@@ -1270,7 +1270,7 @@ gabble_vcard_manager_request (GabbleVCardManager *self,
   g_assert (entry->vcard_node == NULL);
 
   if (timeout == 0)
-    timeout = DEFAULT_REQUEST_TIMEOUT;
+    timeout = default_request_timeout;
 
   request = g_slice_new0 (GabbleVCardManagerRequest);
   DEBUG ("Created request %p to retrieve <%u>'s vCard", request, handle);
@@ -1506,3 +1506,9 @@ gabble_vcard_manager_set_suspend_reply_timeout (guint timeout)
 {
   request_wait_delay = timeout;
 }
+
+void
+gabble_vcard_manager_set_default_request_timeout (guint timeout)
+{
+  default_request_timeout = timeout;
+}
diff --git a/src/vcard-manager.h b/src/vcard-manager.h
index 844dcc8..65a42cb 100644
--- a/src/vcard-manager.h
+++ b/src/vcard-manager.h
@@ -130,6 +130,7 @@ gchar *vcard_get_avatar_sha1 (LmMessageNode *vcard);
 
 /* For unit tests only */
 void gabble_vcard_manager_set_suspend_reply_timeout (guint timeout);
+void gabble_vcard_manager_set_default_request_timeout (guint timeout);
 
 G_END_DECLS
 
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 232aa4a..1f1d69a 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -81,6 +81,7 @@ main (int argc,
   gabble_connection_set_disco_reply_timeout (3);
   /* needed for test-avatar-async.py */
   gabble_vcard_manager_set_suspend_reply_timeout (3);
+  gabble_vcard_manager_set_default_request_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