[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27927 - in gnunet/src: ats include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27927 - in gnunet/src: ats include |
Date: |
Thu, 11 Jul 2013 16:44:03 +0200 |
Author: wachs
Date: 2013-07-11 16:44:03 +0200 (Thu, 11 Jul 2013)
New Revision: 27927
Modified:
gnunet/src/ats/ats_api_scheduling.c
gnunet/src/include/gnunet_ats_service.h
Log:
new function to check if session is known to ats
required for two reasons:
we cannot update metrics for validation sessions since these are not known to
ats
a remote peer can decide to use an inbound validation session to transmit data,
so we have to add the session to ats if we receive payload on a session
Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2013-07-11 14:39:20 UTC (rev 27926)
+++ gnunet/src/ats/ats_api_scheduling.c 2013-07-11 14:44:03 UTC (rev 27927)
@@ -1134,6 +1134,32 @@
/**
+ * Test if a address and a session is known to ATS
+ *
+ * @param sh the scheduling handle
+ * @param address the address
+ * @param session the session
+ * @return GNUNET_YES or GNUNET_NO
+ */
+int
+GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh,
+
const struct GNUNET_HELLO_Address *address,
+
struct Session *session)
+{
+ int s;
+ if (NULL != session)
+ {
+ if (NOT_FOUND != (s = find_session_id (sh, session, &address->peer)))
+ {
+ /* Existing */
+ return GNUNET_YES;
+ }
+ return GNUNET_NO;
+ }
+ return GNUNET_NO;
+}
+
+/**
* We have a new address ATS should know. Addresses have to be added with this
* function before they can be: updated, set in use and destroyed
*
@@ -1184,14 +1210,9 @@
if (NULL != session)
{
- s = find_session_id (sh, session, &address->peer);
- if (NOT_FOUND != s)
+ if (NOT_FOUND != (s = find_session_id (sh, session, &address->peer)))
{
/* Already existing, nothing todo */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding duplicate address for peer `%s', plugin `%s',
session %p id %u\n",
- GNUNET_i2s (&address->peer),
- address->transport_name, session, s);
return GNUNET_SYSERR;
}
s = find_empty_session_slot (sh, session, &address->peer);
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2013-07-11 14:39:20 UTC (rev
27926)
+++ gnunet/src/include/gnunet_ats_service.h 2013-07-11 14:44:03 UTC (rev
27927)
@@ -644,6 +644,19 @@
socklen_t addrlen);
/**
+ * Test if a address and a session is known to ATS
+ *
+ * @param sh the scheduling handle
+ * @param address the address
+ * @param session the session
+ * @return GNUNET_YES or GNUNET_NO
+ */
+int
+GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh,
+
const struct GNUNET_HELLO_Address *address,
+
struct Session *session);
+
+/**
* We have a new address ATS should know. Addresses have to be added with this
* function before they can be: updated, set in use and destroyed
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27927 - in gnunet/src: ats include,
gnunet <=