GAS_mlp_done (struct GAS_MLP_Handle *mlp)
{
struct ATS_Peer * peer;
- struct ATS_Peer * tmp;
+ struct ATS_Address *addr;
GNUNET_assert (mlp != NULL);
peer = mlp->peer_head;
while (peer != NULL)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up peer `%s'\n", GNUNET_i2s (&peer->id));
GNUNET_CONTAINER_DLL_remove(mlp->peer_head, mlp->peer_tail, peer);
- tmp = peer->next;
+ for (addr = peer->head; NULL != addr; addr = peer->head)
+ {
+ GNUNET_CONTAINER_DLL_remove(peer->head, peer->tail, addr);
+ GNUNET_free (addr->mlp_information);
+ addr->mlp_information = NULL;
+ }
GNUNET_free (peer);
- peer = tmp;
+ peer = mlp->peer_head;
}
mlp_delete_problem (mlp);
Boston, MA 02111-1307, USA.
*/
/**
- * @file ats/test_ats_mlp.c
- * @brief test for the MLP solver
+ * @file ats/perf_ats_mlp
+ * @brief performance test for the MLP solver
* @author Christian Grothoff
* @author Matthias Wachs
unsigned int c = 0;
unsigned int c2 = 0;
unsigned int ca = 0;
- //char * pid;
if (peers == 0)
peers = DEF_PEERS;
for (c2=0; c2 < addresses; c2++)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting up address %u for peer %u\n", c2, c);
+ /* Setting required information */
a[ca].mlp_information = NULL;
+ a[ca].prev = NULL;
+ a[ca].next = NULL;
+
+ /* Setting address */
a[ca].peer = p[c].id;
a[ca].plugin = strdup("test");
+ a[ca].atsp_network_type = GNUNET_ATS_NET_LOOPBACK;
+
//a[ca].addr = GNUNET_HELLO_address_allocate(&a[ca].peer, a[ca].plugin, NULL, 0);
//a[ca].addr_len = GNUNET_HELLO_address_get_size(a[ca].addr);
a[ca].ats = GNUNET_malloc (2 * sizeof (struct GNUNET_ATS_Information));
a[ca].ats[1].value = 2;
a[ca].ats_count = 2;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting up address %u\n", ca);
- ca++;
- /*
GNUNET_CONTAINER_multihashmap_put (amap, &a[ca].peer.hashPubKey, &a[ca], GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
GAS_mlp_address_update(mlp, amap, &a[ca]);
- */
- }
+ ca++;
+ }
}
-
-
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Problem contains %u peers and %u adresses\n", mlp->c_p, mlp->addr_in_problem);
+
/* Solving the problem */
//GAS_mlp_solve_problem(mlp);
-
- //GAS_mlp_done (mlp);
+ GAS_mlp_done (mlp);
for (ca=0; ca < (peers * addresses); ca++)
{
GNUNET_free (a[ca].ats);
// GNUNET_free ((void *) a[c2].addr);
}
+ GNUNET_CONTAINER_multihashmap_destroy(amap);
ret = 0;
return;
main (int argc, char *argv[])
{
- static char *const argv2[] = { "test_ats_mlp",
- "-c",
- "test_ats_api.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#else
- "-L", "WARNING",
-#endif
- NULL
- };
-
static struct GNUNET_GETOPT_CommandLineOption options[] = {
{'a', "addresses", NULL,
gettext_noop ("addresses per peer"), 1,
GNUNET_GETOPT_OPTION_END
};
- GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_ats_mlp", "nohelp", options,
+ GNUNET_PROGRAM_run (argc, argv,
+ "perf_ats_mlp", "nohelp", options,
&check, NULL);
return ret;
}
-/* end of file test_ats_api_bandwidth_consumption.c */
+/* end of file perf_ats_mlp.c */