fix
[oweals/gnunet.git] / src / transport / gnunet-transport.c
index 383d14d2fcd445e94a1741c17257cc686a0f8345..36c02014ebf3ef234e37562f246420a2218db7dc 100644 (file)
@@ -284,7 +284,7 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
       adv_port = bnd_port;
     if (NULL == resolver)
       resolver =
-         GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-resolver",
+         GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-resolver",
                                    "gnunet-service-resolver", NULL);
     resolver_users++;
     GNUNET_RESOLVER_connect (cfg);
@@ -607,24 +607,18 @@ shutdown_task (void *cls,
   }
 }
 
-
-
-/**
- * Main function that will be run by the scheduler.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be NULL!)
- * @param cfg configuration
- */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
+testservice_task (void *cls,
+                  const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  if (test_configuration)
+  struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+
+  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT))
   {
-    do_test_configuration (cfg);
+      FPRINTF (stderr, _("Service `%s' is not running\n"), "transport");
+      return;
   }
+
   if (benchmark_send && (NULL == cpid))
   {
     FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
@@ -655,6 +649,7 @@ run (void *cls, char *const *args, const char *cfgfile,
         GNUNET_TRANSPORT_connect (cfg, NULL, NULL, &notify_receive,
                                   &notify_connect, &notify_disconnect);
     GNUNET_TRANSPORT_try_connect (handle, &pid);
+    start_time = GNUNET_TIME_absolute_get ();
     end =
         GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
                                       &do_disconnect, NULL);
@@ -683,6 +678,32 @@ run (void *cls, char *const *args, const char *cfgfile,
                                     NULL);
     }
   }
+
+
+}
+
+
+/**
+ * Main function that will be run by the scheduler.
+ *
+ * @param cls closure
+ * @param args remaining command-line arguments
+ * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param cfg configuration
+ */
+static void
+run (void *cls, char *const *args, const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  if (test_configuration)
+  {
+    do_test_configuration (cfg);
+  }
+
+  GNUNET_CLIENT_service_test ("transport", cfg,
+      GNUNET_TIME_UNIT_SECONDS,
+      &testservice_task,
+      (void *) cfg);
 }