gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13750 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r13750 - gnunet/src/testing
Date: Fri, 19 Nov 2010 13:45:22 +0100

Author: nevans
Date: 2010-11-19 13:45:22 +0100 (Fri, 19 Nov 2010)
New Revision: 13750

Modified:
   gnunet/src/testing/testing.c
Log:
partial fix for missing connect notifications from remote peers, still a 
problem somewhere though(!)

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2010-11-19 12:31:15 UTC (rev 13749)
+++ gnunet/src/testing/testing.c        2010-11-19 12:45:22 UTC (rev 13750)
@@ -1267,6 +1267,11 @@
   struct GNUNET_CORE_Handle *d1core;
 
   /**
+   * Have we actually connected to the core of the first daemon yet?
+   */
+  int d1core_ready;
+
+  /**
    * Testing handle to the second daemon.
    */
   struct GNUNET_TESTING_Daemon *d2;
@@ -1519,7 +1524,7 @@
   ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK;
   if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
     return;
-  if ((ctx->d2->hello != NULL)
+  if ((ctx->d1core_ready == GNUNET_YES) && (ctx->d2->hello != NULL)
       && (NULL != GNUNET_HELLO_get_header (ctx->d2->hello)))
     {
       hello = GNUNET_HELLO_get_header (ctx->d2->hello);
@@ -1548,6 +1553,20 @@
                                                        &send_hello, ctx);
 }
 
+void
+core_init_notify (void *cls,
+                  struct GNUNET_CORE_Handle * server,
+                  const struct GNUNET_PeerIdentity *
+                  my_identity,
+                  const struct
+                  GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *
+                  publicKey)
+{
+  struct ConnectContext *connect_ctx = cls;
+
+  connect_ctx->d1core_ready = GNUNET_YES;
+}
+
 /**
  * Establish a connection between two GNUnet daemons.
  *
@@ -1594,9 +1613,10 @@
               d1->shortname, d2->shortname);
 #endif
 
+  /* FIXME: possible bug, core gets connected after peers are connected, thus 
the connect_notify function is never called (?) */
   ctx->d1core = GNUNET_CORE_connect (d1->cfg, 1,
                                      ctx,
-                                     NULL,
+                                     &core_init_notify,
                                      &connect_notify, NULL, NULL,
                                      NULL, GNUNET_NO,
                                      NULL, GNUNET_NO, no_handlers);




reply via email to

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