aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_validation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-02 09:06:01 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-02 09:06:01 +0000
commit3a21bfdc09c029c70fb3fb717b3d698e832be1a4 (patch)
tree0dd366f2bdaabd35f0236b1600dbb34a86157be8 /src/transport/gnunet-service-transport_validation.c
parent25f4b967570c78fda024b267c19669912d58e675 (diff)
downloadgnunet-3a21bfdc09c029c70fb3fb717b3d698e832be1a4.tar.gz
gnunet-3a21bfdc09c029c70fb3fb717b3d698e832be1a4.zip
don't add addrs like crazy
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r--src/transport/gnunet-service-transport_validation.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index db6cfabe8..a79803afc 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -217,6 +217,12 @@ struct ValidationEntry
217 */ 217 */
218 size_t addrlen; 218 size_t addrlen;
219 219
220 /**
221 * When passing the address in 'add_valid_peer_address', did we
222 * copy the address to the HELLO yet?
223 */
224 int copied;
225
220}; 226};
221 227
222 228
@@ -865,12 +871,17 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
865 * @param cls the 'struct ValidationEntry' with the validated address 871 * @param cls the 'struct ValidationEntry' with the validated address
866 * @param max space in buf 872 * @param max space in buf
867 * @param buf where to add the address 873 * @param buf where to add the address
874 * @return number of bytes written, 0 to signal the
875 * end of the iteration.
868 */ 876 */
869static size_t 877static size_t
870add_valid_peer_address (void *cls, size_t max, void *buf) 878add_valid_peer_address (void *cls, size_t max, void *buf)
871{ 879{
872 struct ValidationEntry *ve = cls; 880 struct ValidationEntry *ve = cls;
873 881
882 if (GNUNET_YES == ve->copied)
883 return 0; /* terminate */
884 ve->copied = GNUNET_YES;
874 return GNUNET_HELLO_add_address (ve->transport_name, ve->valid_until, 885 return GNUNET_HELLO_add_address (ve->transport_name, ve->valid_until,
875 ve->addr, ve->addrlen, buf, max); 886 ve->addr, ve->addrlen, buf, max);
876} 887}
@@ -968,6 +979,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
968 // GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, NULL, 0); /* FIXME: compute and add latency here... */ 979 // GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, NULL, 0); /* FIXME: compute and add latency here... */
969 980
970 /* build HELLO to store in PEERINFO */ 981 /* build HELLO to store in PEERINFO */
982 ve->copied = GNUNET_NO;
971 hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); 983 hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve);
972 GNUNET_PEERINFO_add_peer (GST_peerinfo, hello); 984 GNUNET_PEERINFO_add_peer (GST_peerinfo, hello);
973 GNUNET_free (hello); 985 GNUNET_free (hello);