gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14619 - gnunet/src/testing
Date: Wed, 9 Mar 2011 12:08:01 +0100

Author: nevans
Date: 2011-03-09 12:08:00 +0100 (Wed, 09 Mar 2011)
New Revision: 14619

Modified:
   gnunet/src/testing/testing.c
Log:
allow peer connect call directly from peer started callback

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2011-03-09 10:54:32 UTC (rev 14618)
+++ gnunet/src/testing/testing.c        2011-03-09 11:08:00 UTC (rev 14619)
@@ -217,6 +217,27 @@
 #endif
 
 /**
+ * Notify of a peer being up and running.  Scheduled as a task
+ * so that variables which may need to be set are set before
+ * the connect callback can set up new operations.
+ *
+ * @param cls the testing daemon
+ * @param tc task scheduler context
+ */
+static void
+notify_daemon_started (void *cls,
+                       const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  struct GNUNET_TESTING_Daemon *d = cls;
+  GNUNET_TESTING_NotifyDaemonRunning cb;
+
+  cb = d->cb;
+  d->cb = NULL;
+  if (NULL != cb)
+    cb (d->cb_cls, &d->id, d->cfg, d, NULL);
+}
+
+/**
  * Finite-state machine for starting GNUnet.
  *
  * @param cls our "struct GNUNET_TESTING_Daemon"
@@ -671,10 +692,11 @@
     #endif
 
       GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d);
-      cb = d->cb;
+      GNUNET_SCHEDULER_add_now(&notify_daemon_started, d);
+      /*cb = d->cb;
       d->cb = NULL;
-      if (NULL != cb) /* FIXME: what happens when this callback calls 
GNUNET_TESTING_daemon_stop? */
-        cb (d->cb_cls, &d->id, d->cfg, d, NULL);
+      if (NULL != cb)
+        cb (d->cb_cls, &d->id, d->cfg, d, NULL);*/
       d->running = GNUNET_YES;
       d->phase = SP_GET_HELLO;
 #endif




reply via email to

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