From: Christian Grothoff Date: Mon, 16 Jun 2014 08:02:52 +0000 (+0000) Subject: optimization: only iterate over mamultipeermap entries that match peer id X-Git-Tag: initial-import-from-subversion-38251~3750 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9a5c11fe129d8572c38e3739adcd218029c87a4e;p=oweals%2Fgnunet.git optimization: only iterate over mamultipeermap entries that match peer id --- diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 766f2fe2a..abba6abb3 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c @@ -341,13 +341,13 @@ find_address_it (void *cls, * @param ats_count number of performance records in @a ats */ static void -ats_perf_mon_cb(void *cls, - const struct GNUNET_HELLO_Address *address, - int active, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, - struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count) +ats_perf_mon_cb (void *cls, + const struct GNUNET_HELLO_Address *address, + int active, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, + const struct GNUNET_ATS_Information *ats, + uint32_t ats_count) { struct PendingResolutions *pr; struct PendingResolutions *cur; @@ -366,7 +366,9 @@ ats_perf_mon_cb(void *cls, GNUNET_free (cur); } - GNUNET_CONTAINER_multipeermap_iterate(addresses, &free_addr_it, NULL); + GNUNET_CONTAINER_multipeermap_iterate (addresses, + &free_addr_it, + NULL); return; } @@ -378,9 +380,10 @@ ats_perf_mon_cb(void *cls, actx.src = address; actx.res = NULL; - GNUNET_CONTAINER_multipeermap_iterate (addresses, - &find_address_it, - &actx); + GNUNET_CONTAINER_multipeermap_get_multiple (addresses, + &address->peer, + &find_address_it, + &actx); if ((NULL != actx.res)) { if ((bandwidth_in.value__ == actx.res->bandwidth_in.value__) && @@ -630,7 +633,9 @@ testservice_ats(void *cls, int result) } else if (op_monitor) { - ph = GNUNET_ATS_performance_init (cfg, &ats_perf_mon_cb, NULL); + ph = GNUNET_ATS_performance_init (cfg, + &ats_perf_mon_cb, + NULL); if (NULL == ph) fprintf (stderr, _("Cannot connect to ATS service, exiting...\n"));