determine network scope for ATS even if we do not yet have a session and only have...
[oweals/gnunet.git] / src / transport / gnunet-service-transport_ats.c
index 90947ddb45a1ab97fa1bf2461670cb8a27a5911c..5124cd57852d22cde8e108bb70883f5aa99468d6 100644 (file)
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 /**
  * @file transport/gnunet-service-transport_ats.h
@@ -249,11 +249,11 @@ find_ai_no_session (const struct GNUNET_HELLO_Address *address)
 
 
 /**
- * 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,
@@ -263,6 +263,19 @@ GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
 }
 
 
+/**
+ * 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.
@@ -465,6 +478,7 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
                                                     GNUNET_HELLO_ADDRESS_INFO_INBOUND));
   ai = find_ai_no_session (address);
   GNUNET_assert (NULL == ai);
+  GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope);
   LOG (GNUNET_ERROR_TYPE_INFO,
        "Notifying ATS about peer `%s''s new address `%s'\n",
        GNUNET_i2s (&address->peer),