gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11336 - in gnunet/src: arm core datastore hostlist include


From: gnunet
Subject: [GNUnet-SVN] r11336 - in gnunet/src: arm core datastore hostlist include transport
Date: Tue, 11 May 2010 21:40:39 +0200

Author: grothoff
Date: 2010-05-11 21:40:39 +0200 (Tue, 11 May 2010)
New Revision: 11336

Modified:
   gnunet/src/arm/arm_api.c
   gnunet/src/core/test_core_api.c
   gnunet/src/core/test_core_api_start_only.c
   gnunet/src/datastore/datastore_api.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist.conf
   gnunet/src/include/gnunet_arm_service.h
   gnunet/src/transport/transport_api.c
Log:
die unstoppable multi api, die

Modified: gnunet/src/arm/arm_api.c
===================================================================
--- gnunet/src/arm/arm_api.c    2010-05-11 19:25:55 UTC (rev 11335)
+++ gnunet/src/arm/arm_api.c    2010-05-11 19:40:39 UTC (rev 11336)
@@ -706,171 +706,4 @@
 }
 
 
-/**
- * Function to call for each service.
- *
- * @param h handle to ARM
- * @param service_name name of the service
- * @param timeout how long to wait before failing for good
- * @param cb callback to invoke when service is ready
- * @param cb_cls closure for callback
- */
-typedef void (*ServiceOperation) (struct GNUNET_ARM_Handle *h,
-                                 const char *service_name,
-                                 struct GNUNET_TIME_Relative timeout,
-                                 GNUNET_ARM_Callback cb, void *cb_cls);
-
-
-/**
- * Context for starting or stopping multiple services.
- */
-struct MultiContext
-{
-  /**
-   * NULL-terminated array of services to start or stop.
-   */
-  char **services;
-
-  /**
-   * Our handle to ARM.
-   */
-  struct GNUNET_ARM_Handle *h;
-
-  /**
-   * Identifies the operation (start or stop).
-   */
-  ServiceOperation op;
-
-  /**
-   * Current position in "services".
-   */
-  unsigned int pos;
-};
-
-
-/**
- * Run the operation for the next service in the multi-service
- * request.
- *
- * @param cls the "struct MultiContext" that is being processed
- * @param success status of the previous operation (ignored)
- */
-static void
-next_operation (void *cls,
-               int success)
-{
-  struct MultiContext *mc = cls;
-  char *pos;
-
-  if (NULL == (pos = mc->services[mc->pos]))
-    {
-      GNUNET_free (mc->services);
-      GNUNET_ARM_disconnect (mc->h);
-      GNUNET_free (mc);
-      return;
-    }
-  mc->pos++;
-  mc->op (mc->h, pos, MULTI_TIMEOUT, &next_operation, mc);
-  GNUNET_free (pos);
-}
-
-
-/**
- * Run a multi-service request.
- *
- * @param cfg configuration to use (needed to contact ARM;
- *        the ARM service may internally use a different
- *        configuration to determine how to start the service).
- * @param sched scheduler to use
- * @param op the operation to perform for each service
- * @param va NULL-terminated list of services
- */
-static void
-run_multi_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                  struct GNUNET_SCHEDULER_Handle *sched,
-                  ServiceOperation op,
-                  va_list va)
-{
-  va_list cp;
-  unsigned int total;
-  struct MultiContext *mc;
-  struct GNUNET_ARM_Handle *h;
-  const char *c;
-
-  h = GNUNET_ARM_connect (cfg, sched, NULL);
-  if (NULL == h)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                 _("Error while trying to transmit to ARM service\n"));
-      return;
-    }
-  total = 1;
-  va_copy (cp, va);
-  while (NULL != (va_arg (cp, const char*))) total++;
-  va_end (cp);
-  mc = GNUNET_malloc (sizeof(struct MultiContext));
-  mc->services = GNUNET_malloc (total * sizeof (char*));
-  mc->h = h;
-  mc->op = op;
-  total = 0;
-  va_copy (cp, va);
-  while (NULL != (c = va_arg (cp, const char*)))
-    mc->services[total++] = GNUNET_strdup (c);
-  va_end (cp);
-  next_operation (mc, GNUNET_YES);
-}
-
-
-/**
- * Start multiple services in the specified order.  Convenience
- * function.  Works asynchronously, failures are not reported.
- *
- * @param cfg configuration to use (needed to contact ARM;
- *        the ARM service may internally use a different
- *        configuration to determine how to start the service).
- * @param sched scheduler to use
- * @param ... NULL-terminated list of service names (const char*)
- */
-void
-GNUNET_ARM_start_services (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                          struct GNUNET_SCHEDULER_Handle *sched,
-                          ...)
-{
-  va_list ap;
-
-  va_start (ap, sched);
-  run_multi_request (cfg, sched, &GNUNET_ARM_start_service, ap);
-  va_end (ap);
-}
-
-
-/**
- * Stop multiple services in the specified order.  Convenience
- * function.  Works asynchronously, failures are not reported.
- * Should normally only be called from gnunet-arm or testcases,
- * stopping a service is generally otherwise a bad idea.
- *
- * @param cfg configuration to use (needed to contact ARM;
- *        the ARM service may internally use a different
- *        configuration to determine how to start the service).
- * @param sched scheduler to use
- * @param ... NULL-terminated list of service names (const char*)
- */
-void
-GNUNET_ARM_stop_services (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                         struct GNUNET_SCHEDULER_Handle *sched,
-                         ...)
-{
-  va_list ap;
-
-  va_start (ap, sched);
-  run_multi_request (cfg, sched, &GNUNET_ARM_stop_service, ap);
-  va_end (ap);
-}
-
-
-
-
-
-
 /* end of arm_api.c */

Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c     2010-05-11 19:25:55 UTC (rev 11335)
+++ gnunet/src/core/test_core_api.c     2010-05-11 19:40:39 UTC (rev 11336)
@@ -82,8 +82,6 @@
   GNUNET_CORE_disconnect (p2.ch);
   GNUNET_TRANSPORT_disconnect (p1.th);
   GNUNET_TRANSPORT_disconnect (p2.th);
-  GNUNET_ARM_stop_services (p1.cfg, sched, "core", NULL);
-  GNUNET_ARM_stop_services (p2.cfg, sched, "core", NULL);
   ok = 0;
 }
 
@@ -99,8 +97,6 @@
   GNUNET_CORE_disconnect (p2.ch);
   GNUNET_TRANSPORT_disconnect (p1.th);
   GNUNET_TRANSPORT_disconnect (p2.th);
-  GNUNET_ARM_stop_services (p1.cfg, sched, "core", NULL);
-  GNUNET_ARM_stop_services (p2.cfg, sched, "core", NULL);
   ok = 42;
 }
 
@@ -300,7 +296,6 @@
                                         "-c", cfgname, NULL);
 #endif
   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-  GNUNET_ARM_start_services (p->cfg, sched, "core", NULL);
   p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, NULL, NULL);
   GNUNET_assert (p->th != NULL);
   GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);

Modified: gnunet/src/core/test_core_api_start_only.c
===================================================================
--- gnunet/src/core/test_core_api_start_only.c  2010-05-11 19:25:55 UTC (rev 
11335)
+++ gnunet/src/core/test_core_api_start_only.c  2010-05-11 19:40:39 UTC (rev 
11336)
@@ -31,7 +31,7 @@
 #include "gnunet_program_lib.h"
 #include "gnunet_scheduler_lib.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define START_ARM GNUNET_YES
 
@@ -142,9 +142,6 @@
       GNUNET_assert (cls == &p2);
       GNUNET_CORE_disconnect (p1.ch);
       GNUNET_CORE_disconnect (p2.ch);
-      GNUNET_ARM_stop_services (p1.cfg, sched, "core", NULL);
-      GNUNET_ARM_stop_services (p2.cfg, sched, "core", NULL);
-
       ok = 0;
     }
 }
@@ -163,7 +160,6 @@
                                         "-c", cfgname, NULL);
 #endif
   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-  GNUNET_ARM_start_services (p->cfg, sched, "core", NULL);
 }
 
 
@@ -209,7 +205,7 @@
 static int
 check ()
 {
-  char *const argv[] = { "test-core-api",
+  char *const argv[] = { "test-core-api-start-only",
     "-c",
     "test_core_api_data.conf",
 #if VERBOSE
@@ -223,7 +219,7 @@
 
   ok = 1;
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
-                      argv, "test-core-api", "nohelp", options, &run, &ok);
+                      argv, "test-core-api-start-only", "nohelp", options, 
&run, &ok);
   stop_arm (&p1);
   stop_arm (&p2);
   return ok;
@@ -234,7 +230,7 @@
 {
   int ret;
 
-  GNUNET_log_setup ("test-core-api",
+  GNUNET_log_setup ("test-core-api-start-only",
 #if VERBOSE
                     "DEBUG",
 #else

Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c        2010-05-11 19:25:55 UTC (rev 
11335)
+++ gnunet/src/datastore/datastore_api.c        2010-05-11 19:40:39 UTC (rev 
11336)
@@ -97,7 +97,6 @@
   c = GNUNET_CLIENT_connect (sched, "datastore", cfg);
   if (c == NULL)
     return NULL; /* oops */
-  GNUNET_ARM_start_services (cfg, sched, "datastore", NULL);
   h = GNUNET_malloc (sizeof(struct GNUNET_DATASTORE_Handle) + 
                     GNUNET_SERVER_MAX_MESSAGE_SIZE);
   h->client = c;

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2010-05-11 19:25:55 UTC 
(rev 11335)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2010-05-11 19:40:39 UTC 
(rev 11336)
@@ -127,7 +127,6 @@
   GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Received HELLO, starting hostlist service.\n");
-  GNUNET_ARM_start_services (p->cfg, sched, "hostlist", NULL);
 }
 
 

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist.conf
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist.conf        2010-05-11 
19:25:55 UTC (rev 11335)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist.conf        2010-05-11 
19:40:39 UTC (rev 11336)
@@ -16,6 +16,7 @@
 
 [arm]
 PORT = 12466
+DEFAULTSERVICES = hostlist
 #GLOBAL_PREFIX = xterm -e valgrind --tool=memcheck
 
 [statistics]

Modified: gnunet/src/include/gnunet_arm_service.h
===================================================================
--- gnunet/src/include/gnunet_arm_service.h     2010-05-11 19:25:55 UTC (rev 
11335)
+++ gnunet/src/include/gnunet_arm_service.h     2010-05-11 19:40:39 UTC (rev 
11336)
@@ -132,38 +132,7 @@
                          GNUNET_ARM_Callback cb, void *cb_cls);
 
 
-/**
- * Start multiple services in the specified order.  Convenience
- * function.  Works asynchronously, failures are not reported.
- *
- * @param cfg configuration to use (needed to contact ARM;
- *        the ARM service may internally use a different
- *        configuration to determine how to start the service).
- * @param sched scheduler to use
- * @param ... NULL-terminated list of service names (const char*)
- */
-void
-GNUNET_ARM_start_services (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                          struct GNUNET_SCHEDULER_Handle *sched,
-                          ...);
 
-
-/**
- * Stop multiple services in the specified order.  Convenience
- * function.  Works asynchronously, failures are not reported.
- *
- * @param cfg configuration to use (needed to contact ARM;
- *        the ARM service may internally use a different
- *        configuration to determine how to start the service).
- * @param sched scheduler to use
- * @param ... NULL-terminated list of service names (const char*)
- */
-void
-GNUNET_ARM_stop_services (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                         struct GNUNET_SCHEDULER_Handle *sched,
-                         ...);
-
-
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2010-05-11 19:25:55 UTC (rev 
11335)
+++ gnunet/src/transport/transport_api.c        2010-05-11 19:40:39 UTC (rev 
11336)
@@ -1278,7 +1278,6 @@
 {
   struct GNUNET_TRANSPORT_Handle *ret;
 
-  GNUNET_ARM_start_services (cfg, sched, "peerinfo", "transport", NULL);
   ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Handle));
   ret->sched = sched;
   ret->cfg = cfg;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]