gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r21618 - in gnunet/src: include testing


From: gnunet
Subject: [GNUnet-SVN] r21618 - in gnunet/src: include testing
Date: Mon, 28 May 2012 20:27:25 +0200

Author: harsha
Date: 2012-05-28 20:27:25 +0200 (Mon, 28 May 2012)
New Revision: 21618

Modified:
   gnunet/src/include/gnunet_testing_lib-new.h
   gnunet/src/testing/testing_new.c
Log:
-reverted GNUNET_TESTING_configuration_create()

Modified: gnunet/src/include/gnunet_testing_lib-new.h
===================================================================
--- gnunet/src/include/gnunet_testing_lib-new.h 2012-05-28 16:56:14 UTC (rev 
21617)
+++ gnunet/src/include/gnunet_testing_lib-new.h 2012-05-28 18:27:25 UTC (rev 
21618)
@@ -146,12 +146,13 @@
  * by 'GNUNET_TESTING_peer_configure'.
  *
  * @param system system to use to coordinate resource usage
- * @param cfg template configuration
- * @return the new configuration; NULL upon error;
+ * @param cfg template configuration to update
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration 
will
+ *           be incomplete and should not be used there upon
  */
-struct GNUNET_CONFIGURATION_Handle *
+int
 GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
-                                    const struct GNUNET_CONFIGURATION_Handle 
*cfg);
+                                    struct GNUNET_CONFIGURATION_Handle *cfg);
 // FIXME: add dual to 'release' ports again...
 
 

Modified: gnunet/src/testing/testing_new.c
===================================================================
--- gnunet/src/testing/testing_new.c    2012-05-28 16:56:14 UTC (rev 21617)
+++ gnunet/src/testing/testing_new.c    2012-05-28 18:27:25 UTC (rev 21618)
@@ -416,13 +416,8 @@
    * The system for which we are building configurations
    */
   struct GNUNET_TESTING_System *system;
-
+  
   /**
-   * The original configuration template
-   */
-  const struct GNUNET_CONFIGURATION_Handle *orig;
-
-  /**
    * The configuration we are building
    */
   struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -465,7 +460,7 @@
   {
     if ((ival != 0) &&
         (GNUNET_YES !=
-         GNUNET_CONFIGURATION_get_value_yesno (uc->orig, "testing",
+         GNUNET_CONFIGURATION_get_value_yesno (uc->cfg, "testing",
                                                single_variable)))
     {
       /* FIXME: What about UDP? */
@@ -480,9 +475,9 @@
     }
     else if ((ival != 0) &&
              (GNUNET_YES ==
-              GNUNET_CONFIGURATION_get_value_yesno (uc->orig, "testing",
+              GNUNET_CONFIGURATION_get_value_yesno (uc->cfg, "testing",
                                                     single_variable)) &&
-             GNUNET_CONFIGURATION_get_value_number (uc->orig, "testing",
+             GNUNET_CONFIGURATION_get_value_number (uc->cfg, "testing",
                                                     per_host_variable,
                                                     &num_per_host))
     {
@@ -495,7 +490,7 @@
   if (0 == strcmp (option, "UNIXPATH"))
   {
     if (GNUNET_YES !=
-        GNUNET_CONFIGURATION_get_value_yesno (uc->orig, "testing",
+        GNUNET_CONFIGURATION_get_value_yesno (uc->cfg, "testing",
                                               single_variable))
     {
       GNUNET_snprintf (uval, sizeof (uval), "%s-%s-%u",
@@ -505,7 +500,7 @@
       value = uval;
     }
     else if ((GNUNET_YES ==
-              GNUNET_CONFIGURATION_get_value_number (uc->orig, "testing",
+              GNUNET_CONFIGURATION_get_value_number (uc->cfg, "testing",
                                                      per_host_variable,
                                                      &num_per_host)) &&
              (num_per_host > 0))
@@ -538,7 +533,7 @@
   char *allowed_hosts;
 
   if (GNUNET_OK != 
-      GNUNET_CONFIGURATION_get_value_string (uc->orig, section, "ACCEPT_FROM",
+      GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, "ACCEPT_FROM",
                                              &orig_allowed_hosts))
   {
     orig_allowed_hosts = "127.0.0.1;";
@@ -565,27 +560,23 @@
  * by 'GNUNET_TESTING_peer_configure'.
  *
  * @param system system to use to coordinate resource usage
- * @param cfg template configuration
- * @return the new configuration; NULL upon error;
+ * @param cfg template configuration to update
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration 
will
+ *           be incomplete and should not be used there upon
  */
-struct GNUNET_CONFIGURATION_Handle *
+int
 GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
-                                    const struct GNUNET_CONFIGURATION_Handle 
*cfg)
+                                    struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct UpdateContext uc;
   
   uc.system = system;
-  uc.orig = cfg;
-  uc.cfg = GNUNET_CONFIGURATION_create ();
+  uc.cfg = cfg;
+  uc.status = GNUNET_OK;
   GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
-  if (GNUNET_OK != uc.status)
-  {
-    GNUNET_CONFIGURATION_destroy (uc.cfg);
-    return NULL;
-  }
   GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc);
   /* FIXME: add other options which enable communication with controller */
-  return uc.cfg;
+  return uc.status;
 }
 
 




reply via email to

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