use NULL as flag for evaluation of query, ensure we pass non-NULL for reply_block...
[oweals/gnunet.git] / src / ats / plugin_ats_proportional.c
index 9ad00bbb36a57bc99744ad26b3db19ac0c8a55f0..9309bc2ea799df575b99b5884aea081cd2ab8552 100644 (file)
@@ -1,6 +1,6 @@
 /*
  This file is part of GNUnet.
- Copyright (C) 2011-2015 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2011-2015 GNUnet e.V.
 
  GNUnet is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
  You should have received a copy of the GNU General Public License
  along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
  */
 /**
  * @file ats/plugin_ats_proportional.c
@@ -215,7 +215,7 @@ is_bandwidth_available_in_network (struct Network *net,
   unsigned int na;
   uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__);
 
-  GNUNET_assert (net->active_addresses + extra >= 0);
+  GNUNET_assert (((int)net->active_addresses) + extra >= 0);
   na = net->active_addresses + extra;
   if (0 == na)
     return GNUNET_YES;
@@ -824,9 +824,10 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
     aw_min = NULL;
     for (aw = asi_best->network->head; NULL != aw; aw = aw->next)
     {
-      if (con_min >
-          (a_con = s->env->get_connectivity (s->env->cls,
-                                             &aw->addr->peer)))
+      if ( (con_min >
+            (a_con = s->env->get_connectivity (s->env->cls,
+                                               &aw->addr->peer))) &&
+           (GNUNET_YES == aw->addr->active) )
       {
         aw_min = aw;
         con_min = a_con;
@@ -836,7 +837,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
     }
     update_active_address (s,
                            aw_min->addr,
-                           &aw->addr->peer);
+                           &aw_min->addr->peer);
   }
   distribute_bandwidth_in_network (s,
                                    asi_best->network);
@@ -878,7 +879,7 @@ GAS_proportional_change_preference (void *solver,
  */
 static void
 GAS_proportional_feedback (void *solver,
-                           struct GNUNET_SERVER_Client *application,
+                           struct GNUNET_SERVICE_Client *application,
                            const struct GNUNET_PeerIdentity *peer,
                            const struct GNUNET_TIME_Relative scope,
                            enum GNUNET_ATS_PreferenceKind kind,