From: Matthias Wachs Date: Wed, 11 Jan 2012 13:18:59 +0000 (+0000) Subject: mlp configuration X-Git-Tag: initial-import-from-subversion-38251~15354 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1854e857263b6eb449eaa286570f391e1d8bf173;p=oweals%2Fgnunet.git mlp configuration --- diff --git a/src/ats/ats.conf b/src/ats/ats.conf index d56227ff2..3b9e1a58e 100644 --- a/src/ats/ats.conf +++ b/src/ats/ats.conf @@ -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 diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 875633a6e..b1bf45050 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c @@ -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); }