binding to specific address
[oweals/gnunet.git] / src / transport / test_transport_api_reliability.c
index f0c9d9db8f02683bfa45bc4f6cc45b937df559fd..18971a986218950e7dc1984edec24c767c73134f 100644 (file)
 #include "transport.h"
 #include "transport-testing.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define VERBOSE_ARM GNUNET_NO
 
 #define START_ARM GNUNET_YES
 
+/**
+ * Testcase timeout
+ */
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+
 /**
  * How long until we give up on transmitting the message?
  */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500)
+#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
+
 
 static char *test_source;
 
@@ -251,13 +257,18 @@ notify_ready (void *cls, size_t size, void *buf)
   unsigned int s;
   unsigned int ret;
 
+  th = NULL;
   if (buf == NULL)
   {
-    GNUNET_break (0);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Timeout occurred while waiting for transmit_ready\n");
+    if (GNUNET_SCHEDULER_NO_TASK != die_task)
+      GNUNET_SCHEDULER_cancel (die_task);
+    die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
     ok = 42;
     return 0;
   }
-  th = NULL;
+
   ret = 0;
   s = get_size (n);
   GNUNET_assert (size >= s);
@@ -290,8 +301,8 @@ notify_ready (void *cls, size_t size, void *buf)
   {
     if (th == NULL)
       th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0,
-                                                   TIMEOUT, &notify_ready,
-                                                   NULL);
+                                                   TIMEOUT_TRANSMIT,
+                                                   &notify_ready, NULL);
     msg_scheduled = n;
   }
   if (n % 5000 == 0)
@@ -348,7 +359,8 @@ sendtask ()
 {
   start_time = GNUNET_TIME_absolute_get ();
   th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0,
-                                               TIMEOUT, &notify_ready, NULL);
+                                               TIMEOUT_TRANSMIT, &notify_ready,
+                                               NULL);
 }
 
 static void