fix for 0002392
[oweals/gnunet.git] / src / ats / perf_ats_mlp.c
index 1edf5a21433400fba1ee6c98541e9500858e17f9..b9ee5e4dccacebddea6ddbbabe932d65f270885b 100644 (file)
@@ -29,9 +29,6 @@
 #include "gnunet_statistics_service.h"
 #include "gnunet-service-ats_addresses_mlp.h"
 
-#define VERBOSE GNUNET_YES
-#define VERBOSE_ARM GNUNET_NO
-
 #define MLP_MAX_EXEC_DURATION   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
 #define MLP_MAX_ITERATIONS      INT_MAX
 
@@ -49,14 +46,14 @@ static unsigned int update_percentage;
 static int start;
 static int end;
 
-struct PeerContext *p;
+struct ATS_Peer *p;
 struct ATS_Address *a;
 
 static int ret;
 
-struct GNUNET_CONTAINER_MultiHashMap * amap;
+static struct GNUNET_CONTAINER_MultiHashMap * amap;
 
-struct GAS_MLP_Handle *mlp;
+static struct GAS_MLP_Handle *mlp;
 
 
 
@@ -170,6 +167,7 @@ update_addresses (struct ATS_Address * a, unsigned int addrs, unsigned int perce
 
       a[cur].ats[u_type].value = u_val;
       updated[cur] = 1;
+      GAS_mlp_address_update(mlp, amap, &a[cur]);
       updates++;
     }
   }
@@ -180,7 +178,7 @@ update_addresses (struct ATS_Address * a, unsigned int addrs, unsigned int perce
 
 static void
 check (void *cls, char *const *args, const char *cfgfile,
-       const struct GNUNET_CONFIGURATION_Handle *cfg)
+       const  struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   unsigned int c = 0;
   unsigned int c2 = 0;
@@ -233,7 +231,7 @@ check (void *cls, char *const *args, const char *cfgfile,
   if ((update_percentage >= 0) && (update_percentage <= 100))
   {
     update = GNUNET_YES;
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Benchmarking with existing presolution and %u \% updated addresses\n", update_percentage);
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Benchmarking with existing presolution and %u%% updated addresses\n", update_percentage);
   }
   else if ((update_percentage > 100) && (update_percentage != UINT_MAX))
   {
@@ -257,7 +255,7 @@ check (void *cls, char *const *args, const char *cfgfile,
 
       /* Setting address */
       a[ca].peer = p[c].id;
-      a[ca].plugin = strdup("test");
+      a[ca].plugin = GNUNET_strdup("test");
       a[ca].atsp_network_type = GNUNET_ATS_NET_LOOPBACK;
 
       a[ca].ats = GNUNET_malloc (DEF_ATS_VALUES * sizeof (struct GNUNET_ATS_Information));
@@ -291,7 +289,7 @@ check (void *cls, char *const *args, const char *cfgfile,
           GNUNET_assert (GNUNET_OK == ctx.lp_result);
           GNUNET_assert (GNUNET_OK == ctx.mlp_result);
           if (GNUNET_YES == numeric)
-            printf ("%u;%u;%llu;%llu\n",mlp->c_p, mlp->addr_in_problem, (long long unsigned int) ctx.lp_duration.rel_value, (long long unsigned int) ctx.mlp_duration.rel_value);
+            printf ("%u;%u;%llu;%llu\n",mlp->c_p, mlp->addr_in_problem, (unsigned long long) ctx.lp_duration.rel_value, (unsigned long long) ctx.mlp_duration.rel_value);
           else
             GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Problem solved for %u peers with %u address successfully (LP: %llu ms / MLP: %llu ms)\n",
                 mlp->c_p, mlp->addr_in_problem, ctx.lp_duration.rel_value, ctx.mlp_duration.rel_value);
@@ -314,13 +312,13 @@ check (void *cls, char *const *args, const char *cfgfile,
           GNUNET_assert (GNUNET_OK == uctx.mlp_result);
           if (GNUNET_YES == numeric)
             printf ("%u;%u;%llu;%llu;%llu;%llu\n",mlp->c_p, mlp->addr_in_problem,
-                (long long unsigned int) ctx.lp_duration.rel_value, (long long unsigned int) ctx.mlp_duration.rel_value,
-                (long long unsigned int) uctx.lp_duration.rel_value, (long long unsigned int) uctx.mlp_duration.rel_value);
+                (unsigned long long) ctx.lp_duration.rel_value, (unsigned long long) ctx.mlp_duration.rel_value,
+                (unsigned long long) uctx.lp_duration.rel_value, (unsigned long long) uctx.mlp_duration.rel_value);
           else
             GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Updated problem solved for %u peers with %u address successfully (Initial: LP/MLP: %llu/%llu ms, Update: %llu/%llu ms)\n",
                 mlp->c_p, mlp->addr_in_problem,
-                (long long unsigned int) ctx.lp_duration.rel_value, (long long unsigned int) ctx.mlp_duration.rel_value,
-                (long long unsigned int) uctx.lp_duration.rel_value, (long long unsigned int) uctx.mlp_duration.rel_value);
+                (unsigned long long) ctx.lp_duration.rel_value, (unsigned long long) ctx.mlp_duration.rel_value,
+                (unsigned long long) uctx.lp_duration.rel_value, (unsigned long long) uctx.mlp_duration.rel_value);
         }
         else
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Solving updated problem with %u peers and %u addresses failed\n", c, c2);