diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 10 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 22 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 4687a0907..07861eaff 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -241,13 +241,17 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
241 | break; | 241 | break; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | |||
245 | GNUNET_assert ((ats_count > 0) && (ats != NULL)); | 244 | GNUNET_assert ((ats_count > 0) && (ats != NULL)); |
246 | 245 | /* | |
246 | FIXME: this gives an address that might not have been validated to | ||
247 | ATS for 'selection', which is probably not what we want; this | ||
248 | might be particularly wrong (as in, possibly hiding bugs with address | ||
249 | validation) as 'GNUNET_ATS_address_update' currently ignores | ||
250 | the expiration given. | ||
251 | */ | ||
247 | GNUNET_ATS_address_update (GST_ats, peer, GNUNET_TIME_absolute_get (), /* valid at least until right now... */ | 252 | GNUNET_ATS_address_update (GST_ats, peer, GNUNET_TIME_absolute_get (), /* valid at least until right now... */ |
248 | plugin_name, session, sender_address, | 253 | plugin_name, session, sender_address, |
249 | sender_address_len, ats, ats_count); | 254 | sender_address_len, ats, ats_count); |
250 | |||
251 | return ret; | 255 | return ret; |
252 | } | 256 | } |
253 | 257 | ||
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); |