aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2015-02-07 12:52:52 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2015-02-07 12:52:52 +0000
commit6a38c6ff47e0410117831e56f01a007ce1996dcf (patch)
tree3597b83da98cc03e294340d314fe3b7fafe4a39e
parenta72fa57c5db1999138d9418cc1cfd3f8ea8e9ce8 (diff)
simplify logic: just use string directly for the plugin name
git-svn-id: https://gnunet.org/svn/gnunet@35128 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/ats/gnunet-service-ats_plugins.c62
-rw-r--r--src/ats/gnunet-service-ats_plugins.h31
2 files changed, 7 insertions, 86 deletions
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c
index 8cc6af46f3..53f12ec10e 100644
--- a/src/ats/gnunet-service-ats_plugins.c
+++ b/src/ats/gnunet-service-ats_plugins.c
@@ -35,11 +35,6 @@
/**
- * Configured ATS solver
- */
-static int ats_mode;
-
-/**
* Solver handle.
*/
static struct GNUNET_ATS_SolverFunctions *sf;
@@ -416,45 +411,16 @@ GAS_plugins_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount];
unsigned long long quotas_out[GNUNET_ATS_NetworkTypeCount];
char *mode_str;
- char *plugin_short;
- int c;
+ unsigned int c;
/* Figure out configured solution method */
if (GNUNET_SYSERR ==
GNUNET_CONFIGURATION_get_value_string (cfg, "ats", "MODE", &mode_str))
{
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"No resource assignment method configured, using proportional approach\n");
- ats_mode = MODE_PROPORTIONAL;
- }
- else
- {
- for (c = 0; c < strlen (mode_str); c++)
- mode_str[c] = toupper (mode_str[c]);
- if (0 == strcmp (mode_str, "PROPORTIONAL"))
- ats_mode = MODE_PROPORTIONAL;
- else if (0 == strcmp (mode_str, "MLP"))
- {
- ats_mode = MODE_MLP;
-#if !HAVE_LIBGLPK
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "Assignment method `%s' configured, but GLPK is not available, please install \n",
- mode_str);
- ats_mode = MODE_PROPORTIONAL;
-#endif
- }
- else if (0 == strcmp (mode_str, "RIL"))
- ats_mode = MODE_RIL;
- else
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "Invalid resource assignment method `%s' configured, using proportional approach\n",
- mode_str);
- ats_mode = MODE_PROPORTIONAL;
- }
- GNUNET_free(mode_str);
+ mode_str = GNUNET_strdup ("proportional");
}
-
load_quotas (cfg,
quotas_out,
quotas_in,
@@ -474,27 +440,13 @@ GAS_plugins_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
env.in_quota[c] = quotas_in[c];
}
- switch (ats_mode) {
- case MODE_PROPORTIONAL:
- plugin_short = "proportional";
- break;
- case MODE_MLP:
- plugin_short = "mlp";
- break;
- case MODE_RIL:
- plugin_short = "ril";
- break;
- default:
- plugin_short = NULL;
- break;
- }
GNUNET_asprintf (&plugin,
"libgnunet_plugin_ats_%s",
- plugin_short);
+ mode_str);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Initializing solver `%s '`%s'\n",
- plugin_short,
- plugin);
+ "Initializing solver `%s'\n",
+ mode_str);
+ GNUNET_free (mode_str);
if (NULL == (sf = GNUNET_PLUGIN_load (plugin, &env)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/ats/gnunet-service-ats_plugins.h b/src/ats/gnunet-service-ats_plugins.h
index 46a1d29fb9..e93ca23ee5 100644
--- a/src/ats/gnunet-service-ats_plugins.h
+++ b/src/ats/gnunet-service-ats_plugins.h
@@ -31,37 +31,6 @@
/**
- * Available ressource assignment modes
- */
-enum ATS_Mode
-{
- /**
- * proportional mode:
- *
- * Assign each peer an equal amount of bandwidth (bw)
- *
- * bw_per_peer = bw_total / #active addresses
- */
- MODE_PROPORTIONAL,
-
- /**
- * MLP mode:
- *
- * Solve ressource assignment as an optimization problem
- * Uses an mixed integer programming solver
- */
- MODE_MLP,
-
- /**
- * Reinforcement Learning mode:
- *
- * Solve resource assignment using a learning agent
- */
- MODE_RIL
-};
-
-
-/**
* Initialize address subsystem. The addresses subsystem manages the addresses
* known and current performance information. It has a solver component
* responsible for the resource allocation. It tells the solver about changes