mlp configuration
authorMatthias Wachs <wachs@net.in.tum.de>
Wed, 11 Jan 2012 13:18:59 +0000 (13:18 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Wed, 11 Jan 2012 13:18:59 +0000 (13:18 +0000)
src/ats/ats.conf
src/ats/gnunet-service-ats_addresses.c

index d56227ff2f1266a4775d499cfa682f4b44d505a7..3b9e1a58ee687081455ec9ccf5f0c77fe04138af 100644 (file)
@@ -10,7 +10,7 @@ ACCEPT_FROM6 = ::1;
 UNIXPATH = /tmp/gnunet-service-ats.sock
 UNIX_MATCH_UID = YES
 UNIX_MATCH_GID = YES
-
+MLP = NO
 WAN_QUOTA_IN = 65536
 WAN_QUOTA_OUT = 65536
 # ATS options
index 875633a6e15da7787daafe7cda6cb07a25591037..b1bf450509dc245b6e43bd410e11639f12e6cda9 100644 (file)
@@ -75,6 +75,12 @@ struct ATS_Address
 
 };
 
+enum ATS_Mode
+{
+       SIMPLE,
+       MLP
+};
+
 static struct GNUNET_CONTAINER_MultiHashMap *addresses;
 
 static unsigned long long wan_quota_in;
@@ -83,6 +89,8 @@ static unsigned long long wan_quota_out;
 
 static unsigned int active_addr_count;
 
+static int ats_mode;
+
 /**
  * Update a bandwidth assignment for a peer.  This trivial method currently
  * simply assigns the same share to all active connections.
@@ -480,6 +488,33 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
                  GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
                                                       "WAN_QUOTA_OUT",
                                                       &wan_quota_out));
+
+
+
+  switch (GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP"))
+  {
+       /* MLP = YES */
+       case GNUNET_YES:
+#if !HAVE_LIBGLPK
+               GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode was configured, but libglpk is not installed, switching to simple mode");
+               ats_mode = SIMPLE;
+               break;
+#else
+               ats_mode = MLP;
+#endif
+               break;
+       /* MLP = NO */
+       case GNUNET_NO:
+               ats_mode = SIMPLE;
+               break;
+       /* No configuration value */
+       case GNUNET_SYSERR:
+               ats_mode = SIMPLE;
+               break;
+       default:
+               break;
+  }
+
   addresses = GNUNET_CONTAINER_multihashmap_create (128);
 }