diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-16 10:10:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-16 10:10:59 +0000 |
commit | 1eef01cd60f92a3d77061d655c0217bd6f9ffce4 (patch) | |
tree | db83ba950eb0ece1efb9b682e379ccd1d0dd4b72 /src/ats-tests/ats-testing.c | |
parent | c1d89ed3cf92fa2492a5639e725aadd74742f135 (diff) | |
download | gnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.tar.gz gnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.zip |
notify performance monitors about destroyed addresses (for #3406)
Diffstat (limited to 'src/ats-tests/ats-testing.c')
-rw-r--r-- | src/ats-tests/ats-testing.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index 6fda20311..a4016a120 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c | |||
@@ -541,14 +541,15 @@ do_comm_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
541 | } | 541 | } |
542 | } | 542 | } |
543 | 543 | ||
544 | |||
544 | static void | 545 | static void |
545 | ats_performance_info_cb (void *cls, | 546 | ats_performance_info_cb (void *cls, |
546 | const struct GNUNET_HELLO_Address *address, | 547 | const struct GNUNET_HELLO_Address *address, |
547 | int address_active, | 548 | int address_active, |
548 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 549 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
549 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 550 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
550 | const struct GNUNET_ATS_Information *ats, | 551 | const struct GNUNET_ATS_Information *ats, |
551 | uint32_t ats_count) | 552 | uint32_t ats_count) |
552 | { | 553 | { |
553 | struct BenchmarkPeer *me = cls; | 554 | struct BenchmarkPeer *me = cls; |
554 | struct BenchmarkPartner *p; | 555 | struct BenchmarkPartner *p; |
@@ -556,8 +557,6 @@ ats_performance_info_cb (void *cls, | |||
556 | int log; | 557 | int log; |
557 | char *peer_id; | 558 | char *peer_id; |
558 | 559 | ||
559 | |||
560 | |||
561 | p = find_partner (me, &address->peer); | 560 | p = find_partner (me, &address->peer); |
562 | if (NULL == p) | 561 | if (NULL == p) |
563 | { | 562 | { |
@@ -634,8 +633,11 @@ ats_performance_info_cb (void *cls, | |||
634 | } | 633 | } |
635 | } | 634 | } |
636 | if (GNUNET_YES == log) | 635 | if (GNUNET_YES == log) |
637 | top->ats_perf_cb (cls, address, address_active, bandwidth_out, bandwidth_in, | 636 | top->ats_perf_cb (cls, address, |
638 | ats, ats_count); | 637 | address_active, |
638 | bandwidth_out, | ||
639 | bandwidth_in, | ||
640 | ats, ats_count); | ||
639 | GNUNET_free(peer_id); | 641 | GNUNET_free(peer_id); |
640 | } | 642 | } |
641 | 643 | ||
@@ -646,7 +648,9 @@ ats_perf_connect_adapter (void *cls, | |||
646 | { | 648 | { |
647 | struct BenchmarkPeer *me = cls; | 649 | struct BenchmarkPeer *me = cls; |
648 | 650 | ||
649 | me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, ats_performance_info_cb, me); | 651 | me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, |
652 | &ats_performance_info_cb, | ||
653 | me); | ||
650 | if (NULL == me->ats_perf_handle) | 654 | if (NULL == me->ats_perf_handle) |
651 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 655 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
652 | "Failed to create ATS performance handle \n"); | 656 | "Failed to create ATS performance handle \n"); |
@@ -857,6 +861,7 @@ GNUNET_ATS_TEST_get_partner (int src, int dest) | |||
857 | return &top->mps[src].partners[dest]; | 861 | return &top->mps[src].partners[dest]; |
858 | } | 862 | } |
859 | 863 | ||
864 | |||
860 | /** | 865 | /** |
861 | * Create a topology for ats testing | 866 | * Create a topology for ats testing |
862 | * | 867 | * |
@@ -872,15 +877,14 @@ GNUNET_ATS_TEST_get_partner (int src, int dest) | |||
872 | */ | 877 | */ |
873 | void | 878 | void |
874 | GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, | 879 | GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, |
875 | unsigned int num_slaves, | 880 | unsigned int num_slaves, |
876 | unsigned int num_masters, | 881 | unsigned int num_masters, |
877 | int test_core, | 882 | int test_core, |
878 | GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, | 883 | GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, |
879 | void *done_cb_cls, | 884 | void *done_cb_cls, |
880 | GNUNET_TRANSPORT_ReceiveCallback transport_recv_cb, | 885 | GNUNET_TRANSPORT_ReceiveCallback transport_recv_cb, |
881 | GNUNET_ATS_AddressInformationCallback log_request_cb) | 886 | GNUNET_ATS_AddressInformationCallback log_request_cb) |
882 | { | 887 | { |
883 | |||
884 | static struct GNUNET_CORE_MessageHandler handlers[] = { | 888 | static struct GNUNET_CORE_MessageHandler handlers[] = { |
885 | {&comm_handle_ping, TEST_MESSAGE_TYPE_PING, 0 }, | 889 | {&comm_handle_ping, TEST_MESSAGE_TYPE_PING, 0 }, |
886 | {&comm_handle_pong, TEST_MESSAGE_TYPE_PONG, 0 }, | 890 | {&comm_handle_pong, TEST_MESSAGE_TYPE_PONG, 0 }, |
@@ -894,7 +898,7 @@ GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, | |||
894 | top->done_cb_cls = done_cb_cls; | 898 | top->done_cb_cls = done_cb_cls; |
895 | top->test_core = test_core; | 899 | top->test_core = test_core; |
896 | top->transport_recv_cb = transport_recv_cb; | 900 | top->transport_recv_cb = transport_recv_cb; |
897 | top->ats_perf_cb = log_request_cb; | 901 | top->ats_perf_cb = &log_request_cb; |
898 | 902 | ||
899 | top->mps = GNUNET_malloc (num_masters * sizeof (struct BenchmarkPeer)); | 903 | top->mps = GNUNET_malloc (num_masters * sizeof (struct BenchmarkPeer)); |
900 | top->sps = GNUNET_malloc (num_slaves * sizeof (struct BenchmarkPeer)); | 904 | top->sps = GNUNET_malloc (num_slaves * sizeof (struct BenchmarkPeer)); |
@@ -905,10 +909,13 @@ GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, | |||
905 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); | 909 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); |
906 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); | 910 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); |
907 | (void) GNUNET_TESTBED_test_run (name, cfg_file, | 911 | (void) GNUNET_TESTBED_test_run (name, cfg_file, |
908 | num_slaves + num_masters, event_mask, &controller_event_cb, NULL, | 912 | num_slaves + num_masters, |
909 | &main_run, NULL); | 913 | event_mask, |
914 | &controller_event_cb, NULL, | ||
915 | &main_run, NULL); | ||
910 | } | 916 | } |
911 | 917 | ||
918 | |||
912 | /** | 919 | /** |
913 | * Shutdown topology | 920 | * Shutdown topology |
914 | */ | 921 | */ |
@@ -917,7 +924,6 @@ GNUNET_ATS_TEST_shutdown_topology (void) | |||
917 | { | 924 | { |
918 | if (NULL == top) | 925 | if (NULL == top) |
919 | return; | 926 | return; |
920 | |||
921 | GNUNET_SCHEDULER_shutdown(); | 927 | GNUNET_SCHEDULER_shutdown(); |
922 | } | 928 | } |
923 | 929 | ||