telepathy-gabble: only set TCP_NODELAY if GABBLE_NODELAY is set

Jonny Lamb jonny at kemper.freedesktop.org
Mon Sep 17 07:08:34 PDT 2012


Module: telepathy-gabble
Branch: master
Commit: 6a82d4dab2a3d89bb15d4e93f9dfe10be609d210
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=6a82d4dab2a3d89bb15d4e93f9dfe10be609d210

Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date:   Thu Aug 30 21:27:03 2012 +0100

only set TCP_NODELAY if GABBLE_NODELAY is set

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 tests/README                |    5 +++++
 tests/twisted/gabbletest.py |    4 +++-
 tests/twisted/main-debug.c  |    9 ++++++---
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tests/README b/tests/README
index 6f96f0b..7cbb727 100644
--- a/tests/README
+++ b/tests/README
@@ -77,6 +77,11 @@ To debug an individual test you can set one of the following env variable:
     bus daemon. The logs are saved to tools/*bustle-logs.
         export GABBLE_TEST_BUSTLE=1
 
+  * GABBLE_NODELAY : to run any Gabble test with TCP_NODELAY set on
+    both Wocky and Twisted's socket. This can speed up tests
+    significantly.
+        export GABBLE_NODELAY=1
+
 == Jingle tests ==
 
 Various jingle tests run the same tests with different dialects. To only test
diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py
index a696b14..c0d4ae7 100644
--- a/tests/twisted/gabbletest.py
+++ b/tests/twisted/gabbletest.py
@@ -399,7 +399,9 @@ class BaseXmlStream(xmlstream.XmlStream):
 
     def connectionMade(self):
         xmlstream.XmlStream.connectionMade(self)
-        self.transport.setTcpNoDelay(True)
+
+        if 'GABBLE_NODELAY' in os.environ:
+            self.transport.setTcpNoDelay(True)
 
     def _cb_priv_list(self, iq):
         send_error_reply(self, iq)
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 7fa0e20..3af8583 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -115,9 +115,12 @@ main (int argc,
    * the connector so let's use ::connection-established. We need to
    * ref the class type as it's not loaded yet.  */
   cls = g_type_class_ref (WOCKY_TYPE_CONNECTOR);
-  g_signal_add_emission_hook (
-      g_signal_lookup ("connection-established", WOCKY_TYPE_CONNECTOR),
-      0, connection_established_cb, NULL, NULL);
+  if (g_getenv ("GABBLE_NODELAY") != NULL)
+    {
+      g_signal_add_emission_hook (
+          g_signal_lookup ("connection-established", WOCKY_TYPE_CONNECTOR),
+          0, connection_established_cb, NULL, NULL);
+    }
 #endif
 
   ret = gabble_main (argc, argv);



More information about the telepathy-commits mailing list