[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21117 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21117 - gnunet/src/ats |
Date: |
Tue, 24 Apr 2012 12:18:09 +0200 |
Author: wachs
Date: 2012-04-24 12:18:09 +0200 (Tue, 24 Apr 2012)
New Revision: 21117
Modified:
gnunet/src/ats/gnunet-service-ats.c
gnunet/src/ats/gnunet-service-ats_addresses.c
Log:
- fixing mantis 2282
Modified: gnunet/src/ats/gnunet-service-ats.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats.c 2012-04-24 09:44:23 UTC (rev 21116)
+++ gnunet/src/ats/gnunet-service-ats.c 2012-04-24 10:18:09 UTC (rev 21117)
@@ -39,6 +39,9 @@
*/
struct GNUNET_STATISTICS_Handle *GSA_stats;
+static struct GNUNET_SERVER_Handle *GSA_server;
+
+
/**
* We have received a 'ClientStartMessage' from a client. Find out which
* type of client it is and notify the respective subsystem.
@@ -107,6 +110,8 @@
static void
cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ GNUNET_SERVER_destroy (GSA_server);
+ GSA_server = NULL;
GAS_addresses_done ();
GAS_scheduling_done ();
GAS_performance_done ();
@@ -152,6 +157,7 @@
GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, 0},
{NULL, NULL, 0, 0}
};
+ GSA_server = server;
GSA_stats = GNUNET_STATISTICS_create ("ats", cfg);
GAS_reservations_init ();
GAS_performance_init (server);
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2012-04-24 09:44:23 UTC
(rev 21116)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2012-04-24 10:18:09 UTC
(rev 21117)
@@ -66,7 +66,9 @@
static int ats_mode;
+static int running;
+
static void
send_bw_notification (struct ATS_Address *aa)
{
@@ -339,6 +341,11 @@
struct ATS_Address *old;
uint32_t i;
+ if (GNUNET_NO == running)
+ return;
+
+ GNUNET_assert (NULL != addresses);
+
aa = create_address (peer,
plugin_name,
plugin_addr, plugin_addr_len,
@@ -510,6 +517,9 @@
{
struct ATS_Address *aa;
+ if (GNUNET_NO == running)
+ return;
+
GNUNET_break (0 < strlen (plugin_name));
aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len,
session_id);
@@ -580,6 +590,8 @@
struct ATS_Address *aa;
struct ATS_Address *old;
+ if (GNUNET_NO == running)
+ return;
aa = create_address(peer, plugin_name, plugin_addr, plugin_addr_len,
session_id);
old = find_exact_address (peer, aa);
@@ -677,6 +689,9 @@
void
GAS_addresses_request_address (const struct GNUNET_PeerIdentity *peer)
{
+ if (GNUNET_NO == running)
+ return;
+
if (ats_mode == SIMPLE)
{
request_address_simple (peer);
@@ -695,6 +710,8 @@
enum GNUNET_ATS_PreferenceKind kind,
float score)
{
+ if (GNUNET_NO == running)
+ return;
#if HAVE_LIBGLPK
if (ats_mode == MLP)
GAS_mlp_address_change_preference (mlp, peer, kind, score);
@@ -718,6 +735,11 @@
char *quota_wan_in_str;
char *quota_wan_out_str;
+ running = GNUNET_NO;
+
+ addresses = GNUNET_CONTAINER_multihashmap_create (128);
+ GNUNET_assert (NULL != addresses);
+
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats",
"WAN_QUOTA_IN", "a_wan_in_str))
{
if (0 == strcmp(quota_wan_in_str, "unlimited") ||
@@ -746,7 +768,6 @@
wan_quota_out = (UINT32_MAX) /10;
}
-
mode = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MLP mode %u", mode);
switch (mode)
@@ -788,7 +809,7 @@
break;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS started with %s mode\n", (SIMPLE
== ats_mode) ? "SIMPLE" : "MLP");
- addresses = GNUNET_CONTAINER_multihashmap_create (128);
+ running = GNUNET_YES;
}
@@ -813,6 +834,9 @@
void
GAS_addresses_destroy_all ()
{
+ if (GNUNET_NO == running)
+ return;
+
if (addresses != NULL)
GNUNET_CONTAINER_multihashmap_iterate (addresses, &free_address_it, NULL);
GNUNET_assert (active_addr_count == 0);
@@ -825,6 +849,7 @@
void
GAS_addresses_done ()
{
+ running = GNUNET_NO;
GAS_addresses_destroy_all ();
GNUNET_CONTAINER_multihashmap_destroy (addresses);
addresses = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21117 - gnunet/src/ats,
gnunet <=