break;
}
}
-
GNUNET_assert ((ats_count > 0) && (ats != NULL));
-
+ /*
+ FIXME: this gives an address that might not have been validated to
+ ATS for 'selection', which is probably not what we want; this
+ might be particularly wrong (as in, possibly hiding bugs with address
+ validation) as 'GNUNET_ATS_address_update' currently ignores
+ the expiration given.
+ */
GNUNET_ATS_address_update (GST_ats, peer, GNUNET_TIME_absolute_get (), /* valid at least until right now... */
plugin_name, session, sender_address,
sender_address_len, ats, ats_count);
-
return ret;
}
struct ValidationEntry *ve;
struct GNUNET_PeerIdentity pid;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
+ struct GNUNET_TRANSPORT_ATS_Information ats;
if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0)
return GNUNET_OK; /* expired */
}
ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen);
ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration);
- struct GNUNET_TRANSPORT_ATS_Information ats;
-
ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
ats.value = htonl (0);
-
GNUNET_ATS_address_update (GST_ats, &pid, ve->valid_until, tname, NULL, addr,
addrlen, &ats, 1);
return GNUNET_OK;
/* validity achieved, remember it! */
ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION);
- struct GNUNET_TRANSPORT_ATS_Information ats;
-
- ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
- ats.value = htonl (0);
- 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... */
-
+ {
+ struct GNUNET_TRANSPORT_ATS_Information ats[2];
+
+ ats[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+ ats[0].value = htonl ((uint32_t) GNUNET_TIME_absolute_get_duration (ve->send_time).rel_value);
+ ats[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ ats[1].value = htonl (0);
+ GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until,
+ ve->transport_name, NULL, ve->addr, ve->addrlen,
+ ats, 2);
+ }
+
/* build HELLO to store in PEERINFO */
ve->copied = GNUNET_NO;
hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve);