gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26038 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r26038 - gnunet/src/testbed
Date: Wed, 6 Feb 2013 10:05:32 +0100

Author: harsha
Date: 2013-02-06 10:05:32 +0100 (Wed, 06 Feb 2013)
New Revision: 26038

Modified:
   gnunet/src/testbed/testbed_api_testbed.c
   gnunet/src/testbed/testbed_api_topology.c
Log:
- rely on topology completion callback instead of counting completed overlay 
connect operations

Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c    2013-02-06 03:03:21 UTC (rev 
26037)
+++ gnunet/src/testbed/testbed_api_testbed.c    2013-02-06 09:05:32 UTC (rev 
26038)
@@ -266,12 +266,6 @@
   unsigned int num_peers;
 
   /**
-   * counter to count overlay connect attempts. This counter includes both
-   * successful and failed overlay connects
-   */
-  unsigned int oc_count;
-
-  /**
    * Expected overlay connects. Should be zero if no topology is relavant
    */
   unsigned int num_oc;
@@ -567,6 +561,27 @@
 
 
 /**
+ * Callbacks of this type are called when topology configuration is completed
+ *
+ * @param cls the operation closure given to
+ *          GNUNET_TESTBED_overlay_configure_topology_va() and
+ *          GNUNET_TESTBED_overlay_configure() calls
+ * @param nsuccess the number of successful overlay connects
+ * @param nfailures the number of overlay connects which failed
+ */
+static void
+topology_completion_callback (void *cls, unsigned int nsuccess,
+                              unsigned int nfailures)
+{
+  struct RunContext *rc = cls;
+
+  rc->state = RC_READY;
+  GNUNET_SCHEDULER_add_continuation (&call_master, rc,
+                                     GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+}
+
+
+/**
  * Function to create peers
  *
  * @param rc the RunContext
@@ -641,27 +656,6 @@
       return;
     }
   }
-  if (NULL != rc->topology_operation)
-  {
-    switch (event->type)
-    {
-    case GNUNET_TESTBED_ET_OPERATION_FINISHED:
-    case GNUNET_TESTBED_ET_CONNECT:
-      rc->oc_count++;
-      break;
-    default:
-      GNUNET_break (0);
-      shutdown_now (rc);
-      return;
-    }
-    if (rc->oc_count == rc->num_oc)
-    {
-      rc->state = RC_READY;
-      GNUNET_SCHEDULER_add_continuation (&call_master, rc,
-                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
-    }
-    goto call_cc;
-  }
   for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next)
   {
     if ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type) &&
@@ -735,8 +729,8 @@
       rc->topology_operation =
           GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers,
                                                      rc->peers, &rc->num_oc,
-                                                     NULL,
-                                                     NULL,
+                                                     
&topology_completion_callback,
+                                                     rc,
                                                      rc->topology,
                                                      rc->random_links,
                                                      
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
@@ -747,8 +741,8 @@
       rc->topology_operation =
           GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers,
                                                      rc->peers, &rc->num_oc,
-                                                     NULL,
-                                                     NULL,
+                                                     
&topology_completion_callback,
+                                                     rc,
                                                      rc->topology,
                                                      rc->topo_file,
                                                      
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
@@ -757,8 +751,8 @@
       rc->topology_operation =
           GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers,
                                                      rc->peers, &rc->num_oc,
-                                                     NULL,
-                                                     NULL,
+                                                     
&topology_completion_callback,
+                                                     rc,
                                                      rc->topology,
                                                      
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
     if (NULL == rc->topology_operation)

Modified: gnunet/src/testbed/testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/testbed_api_topology.c   2013-02-06 03:03:21 UTC (rev 
26037)
+++ gnunet/src/testbed/testbed_api_topology.c   2013-02-06 09:05:32 UTC (rev 
26038)
@@ -892,12 +892,10 @@
     break;
   case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
     gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_NO);
-
     break;
   case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING:
     gen_topo_ring (tc);
     gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_YES);
-
     break;
   case GNUNET_TESTBED_TOPOLOGY_CLIQUE:
     tc->link_array_size = num_peers * (num_peers - 1);




reply via email to

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