convert conversation_api_call.c
[oweals/gnunet.git] / src / ats / perf_ats_solver.c
index ef4c3ec5a7f65fbc5baabbc68d8a80aec3f687bc..9c15c802e90c19f9a10875c9604b272ead1ccc44 100644 (file)
@@ -1,6 +1,6 @@
 /*
  This file is part of GNUnet.
- Copyright (C) 2010,2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010,2011 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/perf_ats_solver.c
@@ -418,7 +418,7 @@ bandwidth_changed_cb (void *cls,
 static const double *
 get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
 {
-  return GAS_normalization_get_preferences_by_peer (NULL, id);
+  return GAS_preference_get_by_peer (NULL, id);
 }
 
 
@@ -866,6 +866,15 @@ evaluate (int iteration)
 }
 
 
+static unsigned int
+get_connectivity_cb (void *cls,
+                     const struct GNUNET_PeerIdentity *peer)
+{
+  return GNUNET_CONTAINER_multipeermap_contains (ph.addresses,
+                                                 peer);
+}
+
+
 /**
  * Evaluate average results for all iterations
  */
@@ -1060,7 +1069,7 @@ do_delete_address (void *cls,
                  GNUNET_CONTAINER_multipeermap_remove (ph.addresses,
                                                        pid,
                                                        cur));
-  ph.sf->s_del (ph.sf->cls, cur, GNUNET_NO);
+  ph.sf->s_del (ph.sf->cls, cur);
   GNUNET_free_non_null (cur->atsi);
   GNUNET_free (cur);
   return GNUNET_OK;
@@ -1180,6 +1189,11 @@ perf_run_iteration (void)
                                                 &do_delete_address,
                                                 NULL);
   }
+  if (GNUNET_NO == ph.bulk_running)
+  {
+    ph.sf->s_bulk_stop (ph.sf->cls);
+    ph.bulk_running = GNUNET_NO;
+  }
 
   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
       "Iteration done\n");
@@ -1292,6 +1306,7 @@ run (void *cls, char * const *args, const char *cfgfile,
   ph.addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
   ph.env.addresses = ph.addresses;
   ph.env.bandwidth_changed_cb = bandwidth_changed_cb;
+  ph.env.get_connectivity = &get_connectivity_cb;
   ph.env.get_preferences = &get_preferences_cb;
   ph.env.network_count = GNUNET_ATS_NetworkTypeCount;
   ph.env.info_cb = &solver_info_cb;