diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-19 14:06:32 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-19 14:06:32 +0000 |
commit | 5aeb7f512e5946aec63567e81c72d64523b17530 (patch) | |
tree | bb52f9972837d6bcbc97f6bbace1c9c7200b2ba0 /src/ats/gnunet-service-ats_addresses.c | |
parent | 7890a308739d2e4714ec5b9f1371da377c59e6b6 (diff) | |
download | gnunet-5aeb7f512e5946aec63567e81c72d64523b17530.tar.gz gnunet-5aeb7f512e5946aec63567e81c72d64523b17530.zip |
preference client management and test
Diffstat (limited to 'src/ats/gnunet-service-ats_addresses.c')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 746dbd7e3..7d0eb48ea 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -291,6 +291,11 @@ struct GAS_Addresses_Handle | |||
291 | int running; | 291 | int running; |
292 | 292 | ||
293 | /** | 293 | /** |
294 | * Preferences clients | ||
295 | */ | ||
296 | int pref_clients; | ||
297 | |||
298 | /** | ||
294 | * Configured ATS solver | 299 | * Configured ATS solver |
295 | */ | 300 | */ |
296 | int ats_mode; | 301 | int ats_mode; |
@@ -1721,8 +1726,10 @@ GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle *handle, | |||
1721 | GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head, | 1726 | GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head, |
1722 | handle->preference_clients_tail, pc); | 1727 | handle->preference_clients_tail, pc); |
1723 | GNUNET_free (pc); | 1728 | GNUNET_free (pc); |
1729 | GNUNET_assert (handle->pref_clients > 0); | ||
1730 | handle->pref_clients --; | ||
1731 | GNUNET_STATISTICS_set (handle->stat, "# active performance clients", handle->pref_clients, GNUNET_NO); | ||
1724 | } | 1732 | } |
1725 | |||
1726 | GAS_normalization_preference_client_disconnect (client); | 1733 | GAS_normalization_preference_client_disconnect (client); |
1727 | } | 1734 | } |
1728 | 1735 | ||
@@ -1764,6 +1771,8 @@ GAS_addresses_preference_change (struct GAS_Addresses_Handle *handle, | |||
1764 | pc->client = client; | 1771 | pc->client = client; |
1765 | GNUNET_CONTAINER_DLL_insert (handle->preference_clients_head, | 1772 | GNUNET_CONTAINER_DLL_insert (handle->preference_clients_head, |
1766 | handle->preference_clients_tail, pc); | 1773 | handle->preference_clients_tail, pc); |
1774 | handle->pref_clients ++; | ||
1775 | GNUNET_STATISTICS_set (handle->stat, "# active performance clients", handle->pref_clients, GNUNET_NO); | ||
1767 | } | 1776 | } |
1768 | 1777 | ||
1769 | handle->env.sf.s_bulk_start (handle->solver); | 1778 | handle->env.sf.s_bulk_start (handle->solver); |
@@ -2019,6 +2028,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2019 | ah->stat = (struct GNUNET_STATISTICS_Handle *) stats; | 2028 | ah->stat = (struct GNUNET_STATISTICS_Handle *) stats; |
2020 | /* Initialize the addresses database */ | 2029 | /* Initialize the addresses database */ |
2021 | ah->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 2030 | ah->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
2031 | ah->pref_clients = 0; | ||
2022 | GNUNET_assert(NULL != ah->addresses); | 2032 | GNUNET_assert(NULL != ah->addresses); |
2023 | 2033 | ||
2024 | /* Figure out configured solution method */ | 2034 | /* Figure out configured solution method */ |
@@ -2205,6 +2215,9 @@ GAS_addresses_done (struct GAS_Addresses_Handle *handle) | |||
2205 | { | 2215 | { |
2206 | GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head, | 2216 | GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head, |
2207 | handle->preference_clients_tail, pcur); | 2217 | handle->preference_clients_tail, pcur); |
2218 | GNUNET_assert (handle->pref_clients > 0); | ||
2219 | handle->pref_clients --; | ||
2220 | GNUNET_STATISTICS_set (handle->stat, "# active performance clients", handle->pref_clients, GNUNET_NO); | ||
2208 | GNUNET_free (pcur); | 2221 | GNUNET_free (pcur); |
2209 | } | 2222 | } |
2210 | 2223 | ||