diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2015-04-09 10:08:55 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2015-04-09 10:08:55 +0000 |
commit | b56915c0dac905b845f0ad81fe77337c768a0e0f (patch) | |
tree | 5a08d8526982939f3f9b129fc3c2b71a8ba2e331 /src/ats-tests/ats-testing.c | |
parent | f9793c90915916e1c6f190ca817b1da3c8945120 (diff) | |
download | gnunet-b56915c0dac905b845f0ad81fe77337c768a0e0f.tar.gz gnunet-b56915c0dac905b845f0ad81fe77337c768a0e0f.zip |
removing GNUNET_ATS_Information from ats-testing and logging
uses GNUNET_ATS_Properties instead
Diffstat (limited to 'src/ats-tests/ats-testing.c')
-rw-r--r-- | src/ats-tests/ats-testing.c | 69 |
1 files changed, 21 insertions, 48 deletions
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index a566a242c..bed1b87dd 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c | |||
@@ -548,8 +548,7 @@ ats_performance_info_cb (void *cls, | |||
548 | int address_active, | 548 | int address_active, |
549 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 549 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
550 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 550 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
551 | const struct GNUNET_ATS_Information *ats, | 551 | const struct GNUNET_ATS_Properties *ats_prop) |
552 | uint32_t ats_count) | ||
553 | { | 552 | { |
554 | struct BenchmarkPeer *me = cls; | 553 | struct BenchmarkPeer *me = cls; |
555 | struct BenchmarkPartner *p; | 554 | struct BenchmarkPartner *p; |
@@ -574,55 +573,23 @@ ats_performance_info_cb (void *cls, | |||
574 | p->bandwidth_in = ntohl (bandwidth_in.value__); | 573 | p->bandwidth_in = ntohl (bandwidth_in.value__); |
575 | p->bandwidth_out = ntohl (bandwidth_out.value__); | 574 | p->bandwidth_out = ntohl (bandwidth_out.value__); |
576 | 575 | ||
577 | for (c_a = 0; c_a < ats_count; c_a++) | 576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s\n", |
578 | { | 577 | (GNUNET_YES == p->me->master) ? "Master" : "Slave", |
579 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s %s %u\n", | 578 | p->me->no, |
580 | (GNUNET_YES == p->me->master) ? "Master" : "Slave", | 579 | GNUNET_i2s (&p->dest->id)); |
581 | p->me->no, | 580 | |
582 | GNUNET_i2s (&p->dest->id), | 581 | p->props.utilization_out = ats_prop->utilization_out; |
583 | GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)), | 582 | p->props.utilization_in = ats_prop->utilization_in; |
584 | ntohl(ats[c_a].value)); | 583 | p->props.scope = ats_prop->scope; |
585 | switch (ntohl (ats[c_a].type )) | 584 | p->props.delay = ats_prop->delay; |
586 | { | 585 | p->props.distance = ats_prop->distance; |
587 | case GNUNET_ATS_ARRAY_TERMINATOR: | 586 | |
588 | break; | ||
589 | case GNUNET_ATS_UTILIZATION_OUT: | ||
590 | if (p->ats_utilization_up != ntohl (ats[c_a].value)) | ||
591 | log = GNUNET_YES; | ||
592 | p->ats_utilization_up = ntohl (ats[c_a].value); | ||
593 | |||
594 | break; | ||
595 | case GNUNET_ATS_UTILIZATION_IN: | ||
596 | if (p->ats_utilization_down != ntohl (ats[c_a].value)) | ||
597 | log = GNUNET_YES; | ||
598 | p->ats_utilization_down = ntohl (ats[c_a].value); | ||
599 | break; | ||
600 | case GNUNET_ATS_NETWORK_TYPE: | ||
601 | if (p->ats_network_type != ntohl (ats[c_a].value)) | ||
602 | log = GNUNET_YES; | ||
603 | p->ats_network_type = ntohl (ats[c_a].value); | ||
604 | break; | ||
605 | case GNUNET_ATS_QUALITY_NET_DELAY: | ||
606 | if (p->ats_delay != ntohl (ats[c_a].value)) | ||
607 | log = GNUNET_YES; | ||
608 | p->ats_delay = ntohl (ats[c_a].value); | ||
609 | break; | ||
610 | case GNUNET_ATS_QUALITY_NET_DISTANCE: | ||
611 | if (p->ats_distance != ntohl (ats[c_a].value)) | ||
612 | log = GNUNET_YES; | ||
613 | p->ats_distance = ntohl (ats[c_a].value); | ||
614 | GNUNET_break (0); | ||
615 | break; | ||
616 | default: | ||
617 | break; | ||
618 | } | ||
619 | } | ||
620 | if (GNUNET_YES == log) | 587 | if (GNUNET_YES == log) |
621 | top->ats_perf_cb (cls, address, | 588 | top->ats_perf_cb (cls, address, |
622 | address_active, | 589 | address_active, |
623 | bandwidth_out, | 590 | bandwidth_out, |
624 | bandwidth_in, | 591 | bandwidth_in, |
625 | ats, ats_count); | 592 | ats_prop); |
626 | GNUNET_free(peer_id); | 593 | GNUNET_free(peer_id); |
627 | } | 594 | } |
628 | 595 | ||
@@ -634,8 +601,7 @@ ats_perf_connect_adapter (void *cls, | |||
634 | struct BenchmarkPeer *me = cls; | 601 | struct BenchmarkPeer *me = cls; |
635 | 602 | ||
636 | me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, | 603 | me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, |
637 | &ats_performance_info_cb, | 604 | &ats_performance_info_cb, me); |
638 | me); | ||
639 | if (NULL == me->ats_perf_handle) | 605 | if (NULL == me->ats_perf_handle) |
640 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 606 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
641 | "Failed to create ATS performance handle \n"); | 607 | "Failed to create ATS performance handle \n"); |
@@ -797,6 +763,13 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, | |||
797 | { | 763 | { |
798 | top->sps[c_s].partners[c_m].me = &top->sps[c_s]; | 764 | top->sps[c_s].partners[c_m].me = &top->sps[c_s]; |
799 | top->sps[c_s].partners[c_m].dest = &top->mps[c_m]; | 765 | top->sps[c_s].partners[c_m].dest = &top->mps[c_m]; |
766 | |||
767 | /* Initialize properties */ | ||
768 | top->sps[c_s].partners[c_m].props.delay = GNUNET_TIME_UNIT_ZERO; | ||
769 | top->sps[c_s].partners[c_m].props.distance = 0; | ||
770 | top->sps[c_s].partners[c_m].props.scope = GNUNET_ATS_NET_UNSPECIFIED; | ||
771 | top->sps[c_s].partners[c_m].props.utilization_in = 0; | ||
772 | top->sps[c_s].partners[c_m].props.utilization_out = 0; | ||
800 | } | 773 | } |
801 | /* Get configuration */ | 774 | /* Get configuration */ |
802 | top->sps[c_s].peer_id_op = GNUNET_TESTBED_peer_get_information (top->sps[c_s].peer, | 775 | top->sps[c_s].peer_id_op = GNUNET_TESTBED_peer_get_information (top->sps[c_s].peer, |