diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-09-19 09:39:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-09-19 09:39:28 +0000 |
commit | ad1b129bbcd973f1c151c5a0b77dd31543fa74d8 (patch) | |
tree | b7de16a4f9c9de7281c285589a146b731802bf7c /src/transport/gnunet-service-transport_validation.c | |
parent | 10a0f31b2d73f188104be40d9c9c5057ffe6c788 (diff) | |
download | gnunet-ad1b129bbcd973f1c151c5a0b77dd31543fa74d8.tar.gz gnunet-ad1b129bbcd973f1c151c5a0b77dd31543fa74d8.zip |
do latency computation - #1768
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 57fa86260..7fcb76396 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -394,6 +394,7 @@ add_valid_address (void *cls, const char *tname, | |||
394 | struct ValidationEntry *ve; | 394 | struct ValidationEntry *ve; |
395 | struct GNUNET_PeerIdentity pid; | 395 | struct GNUNET_PeerIdentity pid; |
396 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key; | 396 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key; |
397 | struct GNUNET_TRANSPORT_ATS_Information ats; | ||
397 | 398 | ||
398 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) | 399 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) |
399 | return GNUNET_OK; /* expired */ | 400 | return GNUNET_OK; /* expired */ |
@@ -405,11 +406,8 @@ add_valid_address (void *cls, const char *tname, | |||
405 | } | 406 | } |
406 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); | 407 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); |
407 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); | 408 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); |
408 | struct GNUNET_TRANSPORT_ATS_Information ats; | ||
409 | |||
410 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | 409 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); |
411 | ats.value = htonl (0); | 410 | ats.value = htonl (0); |
412 | |||
413 | GNUNET_ATS_address_update (GST_ats, &pid, ve->valid_until, tname, NULL, addr, | 411 | GNUNET_ATS_address_update (GST_ats, &pid, ve->valid_until, tname, NULL, addr, |
414 | addrlen, &ats, 1); | 412 | addrlen, &ats, 1); |
415 | return GNUNET_OK; | 413 | return GNUNET_OK; |
@@ -979,12 +977,18 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
979 | 977 | ||
980 | /* validity achieved, remember it! */ | 978 | /* validity achieved, remember it! */ |
981 | ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); | 979 | ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); |
982 | struct GNUNET_TRANSPORT_ATS_Information ats; | 980 | { |
983 | 981 | struct GNUNET_TRANSPORT_ATS_Information ats[2]; | |
984 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | 982 | |
985 | ats.value = htonl (0); | 983 | ats[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY); |
986 | GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, &ats, 1); /* FIXME: compute and add latency here... */ | 984 | ats[0].value = htonl ((uint32_t) GNUNET_TIME_absolute_get_duration (ve->send_time).rel_value); |
987 | 985 | ats[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | |
986 | ats[1].value = htonl (0); | ||
987 | GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, | ||
988 | ve->transport_name, NULL, ve->addr, ve->addrlen, | ||
989 | ats, 2); | ||
990 | } | ||
991 | |||
988 | /* build HELLO to store in PEERINFO */ | 992 | /* build HELLO to store in PEERINFO */ |
989 | ve->copied = GNUNET_NO; | 993 | ve->copied = GNUNET_NO; |
990 | hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); | 994 | hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); |