aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tool
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-16 10:10:59 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-16 10:10:59 +0000
commit1eef01cd60f92a3d77061d655c0217bd6f9ffce4 (patch)
treedb83ba950eb0ece1efb9b682e379ccd1d0dd4b72 /src/ats-tool
parentc1d89ed3cf92fa2492a5639e725aadd74742f135 (diff)
downloadgnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.tar.gz
gnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.zip
notify performance monitors about destroyed addresses (for #3406)
Diffstat (limited to 'src/ats-tool')
-rw-r--r--src/ats-tool/gnunet-ats.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index a1e2df7a6..0c7b19790 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -438,7 +438,7 @@ transport_addr_to_str_cb (void *cls,
438 ntohl (pr->bandwidth_out.value__), 438 ntohl (pr->bandwidth_out.value__),
439 ntohl (pr->bandwidth_in.value__), 439 ntohl (pr->bandwidth_in.value__),
440 ats_str); 440 ats_str);
441 GNUNET_free(ats_str); 441 GNUNET_free (ats_str);
442} 442}
443 443
444 444
@@ -490,8 +490,10 @@ find_address_it (void *cls,
490 * 490 *
491 * @param cls closure (NULL) 491 * @param cls closure (NULL)
492 * @param address the address, NULL if ATS service was disconnected 492 * @param address the address, NULL if ATS service was disconnected
493 * @param address_active is this address actively used to maintain a connection 493 * @param active #GNUNET_YES if this address is actively used
494 to a peer 494 * to maintain a connection to a peer;
495 * #GNUNET_NO if the address is not actively used;
496 * #GNUNET_SYSERR if this address is no longer available for ATS
495 * @param bandwidth_out assigned outbound bandwidth for the connection 497 * @param bandwidth_out assigned outbound bandwidth for the connection
496 * @param bandwidth_in assigned inbound bandwidth for the connection 498 * @param bandwidth_in assigned inbound bandwidth for the connection
497 * @param ats performance data for the address (as far as known) 499 * @param ats performance data for the address (as far as known)
@@ -528,6 +530,34 @@ ats_perf_mon_cb (void *cls,
528 NULL); 530 NULL);
529 return; 531 return;
530 } 532 }
533 if (GNUNET_SYSERR == active)
534 {
535 /* remove address */
536 struct AddressFindCtx actx;
537
538 actx.src = address;
539 actx.res = NULL;
540 GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
541 &address->peer,
542 &find_address_it,
543 &actx);
544 if (NULL == actx.res)
545 {
546 GNUNET_break (0);
547 return;
548 }
549 GNUNET_break (GNUNET_OK ==
550 GNUNET_CONTAINER_multipeermap_remove (addresses,
551 &address->peer,
552 actx.res));
553 FPRINTF (stderr,
554 _("Removed address of peer `%s' with plugin `%s'\n"),
555 GNUNET_i2s (&address->peer),
556 actx.res->address->transport_name);
557 GNUNET_HELLO_address_free (actx.res);
558 GNUNET_free (actx.res);
559 return;
560 }
531 561
532 if (GNUNET_NO == verbose) 562 if (GNUNET_NO == verbose)
533 { 563 {
@@ -536,7 +566,6 @@ ats_perf_mon_cb (void *cls,
536 566
537 actx.src = address; 567 actx.src = address;
538 actx.res = NULL; 568 actx.res = NULL;
539
540 GNUNET_CONTAINER_multipeermap_get_multiple (addresses, 569 GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
541 &address->peer, 570 &address->peer,
542 &find_address_it, 571 &find_address_it,
@@ -836,7 +865,11 @@ testservice_ats (void *cls,
836 _("Cannot connect to ATS service, exiting...\n")); 865 _("Cannot connect to ATS service, exiting...\n"));
837 866
838 alh = GNUNET_ATS_performance_list_addresses (ph, 867 alh = GNUNET_ATS_performance_list_addresses (ph,
839 (NULL == pid_str) ? NULL : &pid, GNUNET_NO, ats_perf_cb, NULL); 868 (NULL == pid_str)
869 ? NULL
870 : &pid,
871 GNUNET_NO,
872 &ats_perf_cb, NULL);
840 if (NULL == alh) 873 if (NULL == alh)
841 { 874 {
842 FPRINTF (stderr, 875 FPRINTF (stderr,