diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-10 23:24:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-10 23:24:01 +0000 |
commit | 1c323bd4cbb388a9e7515a1f733a3062bf093aee (patch) | |
tree | 7cc525d79149d44840b9f7a0040aaf3e69ecd665 /src/transport/gnunet-service-transport_validation.c | |
parent | aedaaed687db1ff20b447378f01ad7306921450c (diff) | |
download | gnunet-1c323bd4cbb388a9e7515a1f733a3062bf093aee.tar.gz gnunet-1c323bd4cbb388a9e7515a1f733a3062bf093aee.zip |
fixing #3657 (replace ATS_Information with struct), but WIHTOUT fixing ATS testcases yet
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index d8966f1a4..b6b323bd0 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -804,7 +804,7 @@ add_valid_address (void *cls, | |||
804 | const struct GNUNET_HELLO_Message *hello = cls; | 804 | const struct GNUNET_HELLO_Message *hello = cls; |
805 | struct ValidationEntry *ve; | 805 | struct ValidationEntry *ve; |
806 | struct GNUNET_PeerIdentity pid; | 806 | struct GNUNET_PeerIdentity pid; |
807 | struct GNUNET_ATS_Information ats; | 807 | struct GNUNET_ATS_Properties prop; |
808 | 808 | ||
809 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) | 809 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) |
810 | return GNUNET_OK; /* expired */ | 810 | return GNUNET_OK; /* expired */ |
@@ -832,13 +832,13 @@ add_valid_address (void *cls, | |||
832 | ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve); | 832 | ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve); |
833 | } | 833 | } |
834 | validation_entry_changed (ve, GNUNET_TRANSPORT_VS_UPDATE); | 834 | validation_entry_changed (ve, GNUNET_TRANSPORT_VS_UPDATE); |
835 | 835 | memset (&prop, 0, sizeof (prop)); | |
836 | ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); | 836 | prop.scope = ve->network; |
837 | ats.value = htonl (ve->network); | 837 | prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2); |
838 | if (GNUNET_YES != ve->known_to_ats) | 838 | if (GNUNET_YES != ve->known_to_ats) |
839 | { | 839 | { |
840 | ve->known_to_ats = GNUNET_YES; | 840 | ve->known_to_ats = GNUNET_YES; |
841 | GST_ats_add_address (address, &ats, 1); | 841 | GST_ats_add_address (address, &prop); |
842 | } | 842 | } |
843 | return GNUNET_OK; | 843 | return GNUNET_OK; |
844 | } | 844 | } |
@@ -1465,23 +1465,20 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1465 | ve->pong_sig_valid_until = GNUNET_TIME_absolute_ntoh (pong->expiration); | 1465 | ve->pong_sig_valid_until = GNUNET_TIME_absolute_ntoh (pong->expiration); |
1466 | ve->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); | 1466 | ve->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); |
1467 | { | 1467 | { |
1468 | struct GNUNET_ATS_Information ats[2]; | ||
1469 | |||
1470 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | ||
1471 | ats[0].value = htonl ((uint32_t) ve->latency.rel_value_us); | ||
1472 | ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); | ||
1473 | ats[1].value = htonl ((uint32_t) ve->network); | ||
1474 | if (GNUNET_YES == ve->known_to_ats) | 1468 | if (GNUNET_YES == ve->known_to_ats) |
1475 | { | 1469 | { |
1476 | GST_ats_update_metrics (ve->address, | 1470 | GST_ats_update_delay (ve->address, |
1477 | NULL, | 1471 | GNUNET_TIME_relative_divide (ve->latency, 2)); |
1478 | ats, | ||
1479 | 2); | ||
1480 | } | 1472 | } |
1481 | else | 1473 | else |
1482 | { | 1474 | { |
1475 | struct GNUNET_ATS_Properties prop; | ||
1476 | |||
1477 | memset (&prop, 0, sizeof (prop)); | ||
1478 | prop.scope = ve->network; | ||
1479 | prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2); | ||
1483 | ve->known_to_ats = GNUNET_YES; | 1480 | ve->known_to_ats = GNUNET_YES; |
1484 | GST_ats_add_address (ve->address, ats, 2); | 1481 | GST_ats_add_address (ve->address, &prop); |
1485 | } | 1482 | } |
1486 | } | 1483 | } |
1487 | if (validations_running > 0) | 1484 | if (validations_running > 0) |