gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10075 - in gnunet: . src/core src/hostlist src/testing


From: gnunet
Subject: [GNUnet-SVN] r10075 - in gnunet: . src/core src/hostlist src/testing
Date: Wed, 20 Jan 2010 22:06:42 +0100

Author: grothoff
Date: 2010-01-20 22:06:42 +0100 (Wed, 20 Jan 2010)
New Revision: 10075

Modified:
   gnunet/TODO
   gnunet/src/core/gnunet-service-core.c
   gnunet/src/core/test_core_api.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
   gnunet/src/testing/testing.c
Log:
fixing non-transport compilation issues

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-01-20 20:56:42 UTC (rev 10074)
+++ gnunet/TODO 2010-01-20 21:06:42 UTC (rev 10075)
@@ -13,11 +13,19 @@
 
 Urgent items (before announcing ng.gnunet.org):
 * CORE:
+  - update core API to reflect changes to transport API
+    (need to pass distance to clients!)
   - test currently fails spectacularly
   - request disconnect not implemented (needs better transport API)
 * topology
   - (forced) disconnect does not work (also CORE API issue)
   - needs testing (not sure the current testcase does much...)
+* testing:
+  - timeout_hello_task is not used but should be (so we can fail 
+    properly)
+  - check that 'GNUNET_TRANSPORT_get_hello' is associated with
+    a TIMEOUT task wherever else appropriate (other testcases
+    in particular!)
 * hostlist
   - test fails (looks like it works, but that's because of a bad
     connectivity notification; somehow core is unable to send

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-01-20 20:56:42 UTC (rev 
10074)
+++ gnunet/src/core/gnunet-service-core.c       2010-01-20 21:06:42 UTC (rev 
10075)
@@ -2880,16 +2880,18 @@
  * Function called by the transport for each received message.
  *
  * @param cls closure
- * @param latency estimated latency for communicating with the
- *             given peer
  * @param peer (claimed) identity of the other peer
  * @param message the message
+ * @param latency estimated latency for communicating with the
+ *             given peer (round-trip)
+ * @param distance in overlay hops, as given by transport plugin
  */
 static void
 handle_transport_receive (void *cls,
+                          const struct GNUNET_PeerIdentity *peer,
+                          const struct GNUNET_MessageHeader *message,
                           struct GNUNET_TIME_Relative latency,
-                          const struct GNUNET_PeerIdentity *peer,
-                          const struct GNUNET_MessageHeader *message)
+                         unsigned int distance)
 {
   struct Neighbour *n;
   struct GNUNET_TIME_Absolute now;
@@ -3073,11 +3075,13 @@
  * @param cls closure
  * @param peer the peer that connected
  * @param latency current latency of the connection
+ * @param distance in overlay hops, as given by transport plugin
  */
 static void
 handle_transport_notify_connect (void *cls,
                                  const struct GNUNET_PeerIdentity *peer,
-                                 struct GNUNET_TIME_Relative latency)
+                                 struct GNUNET_TIME_Relative latency,
+                                unsigned int distance)
 {
   struct Neighbour *n;
   struct GNUNET_TIME_Absolute now;

Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c     2010-01-20 20:56:42 UTC (rev 10074)
+++ gnunet/src/core/test_core_api.c     2010-01-20 21:06:42 UTC (rev 10075)
@@ -243,16 +243,14 @@
 
 static void
 process_hello (void *cls,
-               struct GNUNET_TIME_Relative latency,
-               const struct GNUNET_PeerIdentity *peer,
                const struct GNUNET_MessageHeader *message)
 {
   struct PeerContext *p = cls;
 
-  GNUNET_assert (peer != NULL);
+  GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received (my) `%s' from transport service of `%4s'\n",
-              "HELLO", GNUNET_i2s (peer));
+              "Received (my) `%s' from transport service\n",
+              "HELLO");
   GNUNET_assert (message != NULL);
   p->hello = GNUNET_malloc (ntohs (message->size));
   memcpy (p->hello, message, ntohs (message->size));
@@ -285,7 +283,7 @@
   GNUNET_ARM_start_services (p->cfg, sched, "core", NULL);
   p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, NULL, NULL);
   GNUNET_assert (p->th != NULL);
-  GNUNET_TRANSPORT_get_hello (p->th, TIMEOUT, &process_hello, p);
+  GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
 }
 
 

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2010-01-20 20:56:42 UTC 
(rev 10074)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist.c   2010-01-20 21:06:42 UTC 
(rev 10075)
@@ -95,11 +95,13 @@
  * @param cls closure
  * @param peer the peer that connected
  * @param latency current latency of the connection
+ * @param distance in overlay hops, as given by transport plugin
  */
 static void
 notify_connect (void *cls,
                const struct GNUNET_PeerIdentity * peer,
-               struct GNUNET_TIME_Relative latency)
+               struct GNUNET_TIME_Relative latency,
+               unsigned int distance)
 {
   if (peer == NULL)
     return;
@@ -120,14 +122,11 @@
 
 static void
 process_hello (void *cls,
-               struct GNUNET_TIME_Relative latency,
-               const struct GNUNET_PeerIdentity *peer,
                const struct GNUNET_MessageHeader *message)
 {
   struct PeerContext *p = cls;
 
-  if (message == NULL)
-    return;
+  GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Received HELLO, starting hostlist service.\n");
   GNUNET_ARM_start_services (p->cfg, sched, "hostlist", NULL);
@@ -151,7 +150,7 @@
   p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, 
                                    &notify_connect, NULL);
   GNUNET_assert (p->th != NULL);
-  GNUNET_TRANSPORT_get_hello (p->th, TIMEOUT, &process_hello, p);
+  GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
 }
 
 

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2010-01-20 20:56:42 UTC (rev 10074)
+++ gnunet/src/testing/testing.c        2010-01-20 21:06:42 UTC (rev 10075)
@@ -973,34 +973,41 @@
 }
 
 
+#if 0
+static void
+timeout_hello_task (void *cls,
+                   const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_TRANSPORT_get_hello_cancel (ctx->d1th, 
+                                    &process_hello, 
+                                    ctx);
+  GNUNET_TRANSPORT_disconnect (ctx->d1th);
+  GNUNET_TRANSPORT_disconnect (ctx->d2th);
+  if (NULL != ctx->cb)
+    ctx->cb (ctx->cb_cls,
+            _("Failed to receive `HELLO' from peer\n"));
+  GNUNET_free (ctx);
+}
+#endif
+
+
 /**
  * Receive the HELLO from one peer, give it to the other
  * and ask them to connect.
  * 
  * @param cls "struct ConnectContext"
- * @param latency how fast is the connection
- * @param peer ID of peer giving us the HELLO
  * @param message HELLO message of peer
  */
 static void
 process_hello (void *cls,
-               struct GNUNET_TIME_Relative latency,
-               const struct GNUNET_PeerIdentity *peer,
                const struct GNUNET_MessageHeader *message)
 {
   struct ConnectContext *ctx = cls;
 
-  if (peer == NULL)
-    {
-      /* signal error */
-      GNUNET_TRANSPORT_disconnect (ctx->d1th);
-      GNUNET_TRANSPORT_disconnect (ctx->d2th);
-      if (NULL != ctx->cb)
-       ctx->cb (ctx->cb_cls,
-                _("Failed to receive `HELLO' from peer\n"));
-      GNUNET_free (ctx);
-      return;
-    }
+  /* first of all, stop the notification stuff */
+  GNUNET_TRANSPORT_get_hello_cancel (ctx->d1th, 
+                                    &process_hello, 
+                                    ctx);
 #if DEBUG_TESTING
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received `%s' from transport service of `%4s'\n",
@@ -1071,9 +1078,10 @@
       if (NULL != cb)
        cb (cb_cls, _("Failed to connect to transport service!\n"));
       return;
-    }
+    }                                         
+  /* FIXME: need to handle timeout: start timeout task 
+     as well here! (use 'timeout_hello_task') */
   GNUNET_TRANSPORT_get_hello (ctx->d1th, 
-                             timeout,
                              &process_hello, 
                              ctx);
 }





reply via email to

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