gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33101 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r33101 - gnunet/src/ats
Date: Wed, 16 Apr 2014 16:53:40 +0200

Author: wachs
Date: 2014-04-16 16:53:40 +0200 (Wed, 16 Apr 2014)
New Revision: 33101

Modified:
   gnunet/src/ats/gnunet-ats-solver-eval.c
   gnunet/src/ats/plugin_ats_proportional.c
Log:
fixes to adding addresses


Modified: gnunet/src/ats/gnunet-ats-solver-eval.c
===================================================================
--- gnunet/src/ats/gnunet-ats-solver-eval.c     2014-04-16 13:06:48 UTC (rev 
33100)
+++ gnunet/src/ats/gnunet-ats-solver-eval.c     2014-04-16 14:53:40 UTC (rev 
33101)
@@ -2835,6 +2835,7 @@
 {
   struct SolverHandle *sh;
   char * solver_str;
+  int c;
 
   switch (type) {
     case GNUNET_ATS_SOLVER_PROPORTIONAL:
@@ -2866,6 +2867,10 @@
   sh->env.network_count = GNUNET_ATS_NetworkTypeCount;
   sh->env.info_cb = &solver_info_cb;
   sh->env.info_cb_cls = NULL;
+  sh->env.network_count = GNUNET_ATS_NetworkTypeCount;
+  int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType;
+  for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
+    sh->env.networks[c] = networks[c];
 
 
   /* start normalization */

Modified: gnunet/src/ats/plugin_ats_proportional.c
===================================================================
--- gnunet/src/ats/plugin_ats_proportional.c    2014-04-16 13:06:48 UTC (rev 
33100)
+++ gnunet/src/ats/plugin_ats_proportional.c    2014-04-16 14:53:40 UTC (rev 
33101)
@@ -736,6 +736,12 @@
         GNUNET_STRINGS_relative_time_to_string 
(GNUNET_TIME_absolute_get_difference (now, current->blocked_until), 
GNUNET_YES));
     return GNUNET_OK;
   }
+  if (NULL == asi)
+  {
+    GNUNET_break (0);
+    return GNUNET_OK;
+  }
+
   if (GNUNET_NO == is_bandwidth_available_in_network (asi->network))
     return GNUNET_OK; /* There's no bandwidth available in this network */
 
@@ -902,6 +908,7 @@
   int c;
   for (c = 0; c < s->network_count; c++)
   {
+    fprintf (stderr, "%u == %u \n", s->network_entries[c].type,type);
     if (s->network_entries[c].type == type)
       return &s->network_entries[c];
   }
@@ -1394,6 +1401,12 @@
 
   s = (struct GAS_PROPORTIONAL_Handle *) solver;
   asi = address->solver_information;
+  if (NULL == asi)
+  {
+    GNUNET_break(0);
+    return;
+  }
+
   n = asi->network;
 
   if (NULL == n)
@@ -1486,6 +1499,14 @@
     return;
   }
 
+  asi = address->solver_information;
+  if (NULL == asi)
+  {
+    GNUNET_break(0);
+    return;
+  }
+
+
   /* Network changed */
   LOG(GNUNET_ERROR_TYPE_DEBUG,
       "Network type changed, moving %s address from `%s' to `%s'\n",
@@ -1521,7 +1542,6 @@
   }
 
   /* Add to new network and update*/
-  asi = address->solver_information;
   asi->network = new_net;
   GAS_proportional_address_add (solver, address, new_network);
   if (GNUNET_YES == save_active)
@@ -1569,6 +1589,12 @@
   if (NULL == net)
   {
     GNUNET_break(0);
+
+    LOG(GNUNET_ERROR_TYPE_ERROR,
+        "Unknown network %u `%s' for new address %p for peer `%s'\n",
+        network, GNUNET_ATS_print_network_type(network),
+        address, GNUNET_i2s(&address->peer));
+
     return;
   }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]