diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-01-11 13:18:59 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-01-11 13:18:59 +0000 |
commit | 1854e857263b6eb449eaa286570f391e1d8bf173 (patch) | |
tree | 65111ec8d675319e6defdee81fa90c11af9c1aa6 | |
parent | d36ea67729b309be186660bada3d795950adef3b (diff) | |
download | gnunet-1854e857263b6eb449eaa286570f391e1d8bf173.tar.gz gnunet-1854e857263b6eb449eaa286570f391e1d8bf173.zip |
mlp configuration
-rw-r--r-- | src/ats/ats.conf | 2 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 35 |
2 files changed, 36 insertions, 1 deletions
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; | |||
10 | UNIXPATH = /tmp/gnunet-service-ats.sock | 10 | UNIXPATH = /tmp/gnunet-service-ats.sock |
11 | UNIX_MATCH_UID = YES | 11 | UNIX_MATCH_UID = YES |
12 | UNIX_MATCH_GID = YES | 12 | UNIX_MATCH_GID = YES |
13 | 13 | MLP = NO | |
14 | WAN_QUOTA_IN = 65536 | 14 | WAN_QUOTA_IN = 65536 |
15 | WAN_QUOTA_OUT = 65536 | 15 | WAN_QUOTA_OUT = 65536 |
16 | # ATS options | 16 | # 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 | |||
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | enum ATS_Mode | ||
79 | { | ||
80 | SIMPLE, | ||
81 | MLP | ||
82 | }; | ||
83 | |||
78 | static struct GNUNET_CONTAINER_MultiHashMap *addresses; | 84 | static struct GNUNET_CONTAINER_MultiHashMap *addresses; |
79 | 85 | ||
80 | static unsigned long long wan_quota_in; | 86 | static unsigned long long wan_quota_in; |
@@ -83,6 +89,8 @@ static unsigned long long wan_quota_out; | |||
83 | 89 | ||
84 | static unsigned int active_addr_count; | 90 | static unsigned int active_addr_count; |
85 | 91 | ||
92 | static int ats_mode; | ||
93 | |||
86 | /** | 94 | /** |
87 | * Update a bandwidth assignment for a peer. This trivial method currently | 95 | * Update a bandwidth assignment for a peer. This trivial method currently |
88 | * simply assigns the same share to all active connections. | 96 | * simply assigns the same share to all active connections. |
@@ -480,6 +488,33 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
480 | GNUNET_CONFIGURATION_get_value_size (cfg, "ats", | 488 | GNUNET_CONFIGURATION_get_value_size (cfg, "ats", |
481 | "WAN_QUOTA_OUT", | 489 | "WAN_QUOTA_OUT", |
482 | &wan_quota_out)); | 490 | &wan_quota_out)); |
491 | |||
492 | |||
493 | |||
494 | switch (GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP")) | ||
495 | { | ||
496 | /* MLP = YES */ | ||
497 | case GNUNET_YES: | ||
498 | #if !HAVE_LIBGLPK | ||
499 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode was configured, but libglpk is not installed, switching to simple mode"); | ||
500 | ats_mode = SIMPLE; | ||
501 | break; | ||
502 | #else | ||
503 | ats_mode = MLP; | ||
504 | #endif | ||
505 | break; | ||
506 | /* MLP = NO */ | ||
507 | case GNUNET_NO: | ||
508 | ats_mode = SIMPLE; | ||
509 | break; | ||
510 | /* No configuration value */ | ||
511 | case GNUNET_SYSERR: | ||
512 | ats_mode = SIMPLE; | ||
513 | break; | ||
514 | default: | ||
515 | break; | ||
516 | } | ||
517 | |||
483 | addresses = GNUNET_CONTAINER_multihashmap_create (128); | 518 | addresses = GNUNET_CONTAINER_multihashmap_create (128); |
484 | } | 519 | } |
485 | 520 | ||