gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16681 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r16681 - gnunet/src/transport
Date: Fri, 2 Sep 2011 11:06:01 +0200

Author: grothoff
Date: 2011-09-02 11:06:01 +0200 (Fri, 02 Sep 2011)
New Revision: 16681

Modified:
   gnunet/src/transport/gnunet-service-transport_validation.c
Log:
don't add addrs like crazy

Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c  2011-09-02 
07:58:43 UTC (rev 16680)
+++ gnunet/src/transport/gnunet-service-transport_validation.c  2011-09-02 
09:06:01 UTC (rev 16681)
@@ -217,6 +217,12 @@
    */
   size_t addrlen;
 
+  /**
+   * When passing the address in 'add_valid_peer_address', did we 
+   * copy the address to the HELLO yet?
+   */
+  int copied;
+
 };
 
 
@@ -865,12 +871,17 @@
  * @param cls the 'struct ValidationEntry' with the validated address
  * @param max space in buf
  * @param buf where to add the address
+ * @return number of bytes written, 0 to signal the
+ *         end of the iteration.
  */
 static size_t
 add_valid_peer_address (void *cls, size_t max, void *buf)
 {
   struct ValidationEntry *ve = cls;
 
+  if (GNUNET_YES == ve->copied)
+    return 0; /* terminate */
+  ve->copied = GNUNET_YES;
   return GNUNET_HELLO_add_address (ve->transport_name, ve->valid_until,
                                    ve->addr, ve->addrlen, buf, max);
 }
@@ -968,6 +979,7 @@
   //  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... */
 
   /* build HELLO to store in PEERINFO */
+  ve->copied = GNUNET_NO;
   hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve);
   GNUNET_PEERINFO_add_peer (GST_peerinfo, hello);
   GNUNET_free (hello);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]