gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36468 - gnunet/src/transport
Date: Wed, 7 Oct 2015 13:54:46 +0200

Author: grothoff
Date: 2015-10-07 13:54:46 +0200 (Wed, 07 Oct 2015)
New Revision: 36468

Modified:
   gnunet/src/transport/gnunet-service-transport_ats.c
   gnunet/src/transport/gnunet-service-transport_ats.h
   gnunet/src/transport/gnunet-service-transport_validation.c
Log:
add additional diagnostics to help localize #3971 invariant violation

Modified: gnunet/src/transport/gnunet-service-transport_ats.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.c 2015-10-07 11:54:25 UTC 
(rev 36467)
+++ gnunet/src/transport/gnunet-service-transport_ats.c 2015-10-07 11:54:46 UTC 
(rev 36468)
@@ -249,11 +249,11 @@
 
 
 /**
- * Test if ATS knows about this address.
+ * Test if ATS knows about this @a address and @a session.
  *
  * @param address the address
  * @param session the session
- * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
+ * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
  */
 int
 GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
@@ -264,6 +264,19 @@
 
 
 /**
+ * Test if ATS knows about this @a address.
+ *
+ * @param address the address
+ * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
+ */
+int
+GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address)
+{
+  return (NULL != find_ai_no_session (address)) ? GNUNET_YES : GNUNET_NO;
+}
+
+
+/**
  * The blocking time for an address has expired, allow ATS to
  * suggest it again.
  *

Modified: gnunet/src/transport/gnunet-service-transport_ats.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.h 2015-10-07 11:54:25 UTC 
(rev 36467)
+++ gnunet/src/transport/gnunet-service-transport_ats.h 2015-10-07 11:54:46 UTC 
(rev 36468)
@@ -42,11 +42,11 @@
 
 
 /**
- * Test if ATS knows about this address.
+ * Test if ATS knows about this @a address and @a session.
  *
  * @param address the address
  * @param session the session
- * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
+ * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
  */
 int
 GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
@@ -54,6 +54,16 @@
 
 
 /**
+ * Test if ATS knows about this @a address.
+ *
+ * @param address the address
+ * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
+ */
+int
+GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address);
+
+
+/**
  * Temporarily block a valid address for use by ATS for address
  * suggestions.  This function should be called if an address was
  * suggested by ATS but failed to perform (i.e. failure to establish a

Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c  2015-10-07 
11:54:25 UTC (rev 36467)
+++ gnunet/src/transport/gnunet-service-transport_validation.c  2015-10-07 
11:54:46 UTC (rev 36468)
@@ -429,6 +429,8 @@
   if (GNUNET_YES == ve->known_to_ats)
   {
     GST_ats_expire_address (ve->address);
+    GNUNET_assert (GNUNET_NO ==
+                   GST_ats_is_known_no_session (ve->address));
     ve->known_to_ats = GNUNET_NO;
   }
   GNUNET_HELLO_address_free (ve->address);
@@ -781,6 +783,8 @@
                                               &validation_entry_match, &vemc);
   if (NULL != (ve = vemc.ve))
     return ve;
+  GNUNET_assert (GNUNET_NO ==
+                 GST_ats_is_known_no_session (address));
   ve = GNUNET_new (struct ValidationEntry);
   ve->in_use = GNUNET_SYSERR; /* not defined */
   ve->address = GNUNET_HELLO_address_copy (address);
@@ -859,6 +863,8 @@
   {
     ve->known_to_ats = GNUNET_YES;
     GST_ats_add_address (address, &prop);
+    GNUNET_assert (GNUNET_YES ==
+                   GST_ats_is_known_no_session (ve->address));
   }
   return GNUNET_OK;
 }
@@ -1490,6 +1496,8 @@
   {
     if (GNUNET_YES == ve->known_to_ats)
     {
+      GNUNET_assert (GNUNET_YES ==
+                     GST_ats_is_known_no_session (ve->address));
       GST_ats_update_delay (ve->address,
                             GNUNET_TIME_relative_divide (ve->latency, 2));
     }
@@ -1500,8 +1508,12 @@
       memset (&prop, 0, sizeof (prop));
       prop.scope = ve->network;
       prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2);
+      GNUNET_assert (GNUNET_NO ==
+                     GST_ats_is_known_no_session (ve->address));
       ve->known_to_ats = GNUNET_YES;
       GST_ats_add_address (ve->address, &prop);
+      GNUNET_assert (GNUNET_YES ==
+                     GST_ats_is_known_no_session (ve->address));
     }
   }
   if (validations_running > 0)




reply via email to

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