[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35000 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35000 - gnunet/src/transport |
Date: |
Sun, 25 Jan 2015 22:27:31 +0100 |
Author: grothoff
Date: 2015-01-25 22:27:31 +0100 (Sun, 25 Jan 2015)
New Revision: 35000
Modified:
gnunet/src/transport/gnunet-service-transport_ats.c
gnunet/src/transport/gnunet-service-transport_ats.h
Log:
fixing wrong assertions
Modified: gnunet/src/transport/gnunet-service-transport_ats.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.c 2015-01-25 21:14:37 UTC
(rev 34999)
+++ gnunet/src/transport/gnunet-service-transport_ats.c 2015-01-25 21:27:31 UTC
(rev 35000)
@@ -108,6 +108,8 @@
fc->ret = ai;
return GNUNET_NO;
}
+ GNUNET_assert ( (fc->session != ai->session) ||
+ (NULL == ai->session) );
return GNUNET_YES;
}
@@ -138,6 +140,21 @@
/**
+ * Test if ATS knows about this address.
+ *
+ * @param address the address
+ * @param session the session
+ * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
+ */
+int
+GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
+ struct Session *session)
+{
+ return (NULL != find_ai (address, session)) ? GNUNET_YES : GNUNET_NO;
+}
+
+
+/**
* Notify ATS about the new address including the network this address is
* located in.
*
@@ -170,10 +187,6 @@
{
GNUNET_break (NULL != session);
}
- else
- {
- GNUNET_break (NULL == session);
- }
ai = find_ai (address, session);
if (NULL != ai)
{
@@ -183,7 +196,7 @@
if (NULL == (papi = GST_plugins_find (address->transport_name)))
{
/* we don't have the plugin for this address */
- GNUNET_break(0);
+ GNUNET_assert (0);
return;
}
if (NULL != session)
@@ -244,7 +257,12 @@
ai = find_ai (address, NULL);
if (NULL == ai)
{
- GNUNET_break (NULL != (find_ai (address, session)));
+ /* We may already be aware of the session, even if some other part
+ of the code could not tell if it just created a new session or
+ just got one recycled from the plugin; hence, we may be called
+ with "new" session even for an "old" session; in that case,
+ check that this is the case, but just ignore it. */
+ GNUNET_assert (NULL != (find_ai (address, session)));
return;
}
GNUNET_break (NULL == ai->session);
@@ -330,9 +348,9 @@
and if we get metrics for those, they were never known to
ATS which means we end up here (however, in this
case, the address must be an outbound address). */
- GNUNET_break (GNUNET_YES !=
- GNUNET_HELLO_address_check_option (address,
-
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
+ GNUNET_assert (GNUNET_YES !=
+ GNUNET_HELLO_address_check_option (address,
+
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
return;
}
@@ -394,7 +412,7 @@
ai = find_ai (address, NULL);
if (NULL == ai)
{
- GNUNET_break (0);
+ GNUNET_assert (0);
return;
}
GNUNET_assert (GNUNET_YES ==
Modified: gnunet/src/transport/gnunet-service-transport_ats.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.h 2015-01-25 21:14:37 UTC
(rev 34999)
+++ gnunet/src/transport/gnunet-service-transport_ats.h 2015-01-25 21:27:31 UTC
(rev 35000)
@@ -51,6 +51,17 @@
/**
+ * Test if ATS knows about this address.
+ *
+ * @param address the address
+ * @param session the session
+ * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
+ */
+int
+GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
+ struct Session *session);
+
+/**
* Notify ATS about the new address including the network this address is
* located in.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35000 - gnunet/src/transport,
gnunet <=