/*
This file is part of GNUnet.
- (C) 2010,2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010,2011 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUNET_free_non_null (ph.iterations_results);
GAS_normalization_stop ();
+ GAS_preference_done ();
ret = res;
}
}
-const double *
+static const double *
get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
{
- return GAS_normalization_get_preferences_by_peer (NULL, id);
-}
-
-
-const double *
-get_property_cb (void *cls, const struct ATS_Address *address)
-{
- return GAS_normalization_get_properties (NULL,
- address);
+ return GAS_preference_get_by_peer (NULL, id);
}
}
+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
*/
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;
&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");
if (0 == strcmp(solver, "proportional"))
{
- ph.ats_mode = MODE_PROPORTIONAL;
ph.ats_string = "proportional";
}
else if (0 == strcmp(solver, "mlp"))
{
- ph.ats_mode = MODE_MLP;
ph.ats_string = "mlp";
}
else if ((0 == strcmp(solver, "ril")))
{
- ph.ats_mode = MODE_RIL;
ph.ats_string = "ril";
}
else
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.get_property = &get_property_cb;
ph.env.network_count = GNUNET_ATS_NetworkTypeCount;
ph.env.info_cb = &solver_info_cb;
- int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType;
for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
{
- ph.env.networks[c] = networks[c];
ph.env.out_quota[c] = quotas_out[c];
ph.env.in_quota[c] = quotas_in[c];
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading network quotas: `%s' %llu %llu \n",
- GNUNET_ATS_print_network_type(ph.env.networks[c]),
- ph.env.out_quota[c],
- ph.env.in_quota[c]);
+ GNUNET_ATS_print_network_type (c),
+ ph.env.out_quota[c],
+ ph.env.in_quota[c]);
}
GAS_normalization_start ();
+ GAS_preference_init ();
GNUNET_asprintf (&plugin, "libgnunet_plugin_ats_%s", ph.ats_string);
GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Initializing solver `%s'\n"), ph.ats_string);