gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: use new ENABLE meth


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: use new ENABLE method to load wire plugins
Date: Fri, 03 Mar 2017 19:44:30 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 364abba  use new ENABLE method to load wire plugins
364abba is described below

commit 364abbaea1383bd7d8311269d596bdc3c1d4b591
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Mar 3 19:44:27 2017 +0100

    use new ENABLE method to load wire plugins
---
 src/exchange/taler-exchange-httpd_validation.c | 84 +++++++++++++-------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_validation.c 
b/src/exchange/taler-exchange-httpd_validation.c
index 541173f..14c1476 100644
--- a/src/exchange/taler-exchange-httpd_validation.c
+++ b/src/exchange/taler-exchange-httpd_validation.c
@@ -66,6 +66,38 @@ static struct Plugin *wire_tail;
 
 
 /**
+ * Load plugin @a name.
+ *
+ * @param cls pointer to `int` to set to #GNUNET_SYSERR on errors
+ * @param name name of the plugin to load
+ */
+static void
+load_plugin (void *cls,
+             const char *name)
+{
+  int *ret = cls;
+  struct Plugin *p;
+
+  p = GNUNET_new (struct Plugin);
+  p->type = GNUNET_strdup (name);
+  p->plugin = TALER_WIRE_plugin_load (cfg,
+                                      name);
+  if (NULL == p->plugin)
+  {
+    GNUNET_free (p);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to load plugin %s\n",
+                name);
+    *ret = GNUNET_SYSERR;
+    return;
+  }
+  GNUNET_CONTAINER_DLL_insert (wire_head,
+                               wire_tail,
+                               p);
+}
+
+
+/**
  * Initialize validation subsystem.
  *
  * @param cfg configuration to use
@@ -74,54 +106,22 @@ static struct Plugin *wire_tail;
 int
 TEH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  struct Plugin *p;
-  char *wireformats;
-  const char *token;
-
-  /* Find out list of supported wire formats */
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg,
-                                             "exchange",
-                                             "wireformat",
-                                             &wireformats))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "exchange",
-                               "wireformat");
-    return GNUNET_SYSERR;
-  }
-  for (token = strtok (wireformats,
-                       " ");
-       NULL != token;
-       token = strtok (NULL,
-                       " "))
-  {
-    p = GNUNET_new (struct Plugin);
-    p->type = GNUNET_strdup (token);
-    p->plugin = TALER_WIRE_plugin_load (cfg,
-                                        token);
-    if (NULL == p->plugin)
-    {
-      GNUNET_free (p);
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Failed to load plugin %s\n",
-                  token);
-      TEH_VALIDATION_done ();
-      return GNUNET_SYSERR;
-    }
-    GNUNET_CONTAINER_DLL_insert (wire_head,
-                                 wire_tail,
-                                 p);
-  }
-  GNUNET_free (wireformats);
+  int ret;
+
+  ret = GNUNET_OK;
+  TALER_WIRE_find_enabled (cfg,
+                           &load_plugin,
+                           &ret);
   if (NULL == wire_head)
   {
     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
                                "exchange",
                                "wireformat");
-    return GNUNET_SYSERR;
+    ret = GNUNET_SYSERR;
   }
-  return GNUNET_OK;
+  if (GNUNET_OK != ret)
+    TEH_VALIDATION_done ();
+  return ret;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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