gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r25067 - in gnunet/src: include mesh testbed


From: gnunet
Subject: [GNUnet-SVN] r25067 - in gnunet/src: include mesh testbed
Date: Tue, 20 Nov 2012 13:29:57 +0100

Author: harsha
Date: 2012-11-20 13:29:57 +0100 (Tue, 20 Nov 2012)
New Revision: 25067

Modified:
   gnunet/src/include/gnunet_testbed_service.h
   gnunet/src/mesh/gnunet-regex-profiler.c
   gnunet/src/testbed/gnunet-testbed-profiler.c
   gnunet/src/testbed/test_testbed_api_topology.c
   gnunet/src/testbed/test_testbed_api_topology_clique.c
   gnunet/src/testbed/testbed_api_testbed.c
   gnunet/src/testbed/testbed_api_topology.c
Log:
extended overlay configure topology to return max connections

Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2012-11-20 12:02:01 UTC (rev 
25066)
+++ gnunet/src/include/gnunet_testbed_service.h 2012-11-20 12:29:57 UTC (rev 
25067)
@@ -1062,6 +1062,8 @@
  * @param op_cls closure argument to give with the operation event
  * @param num_peers number of peers in 'peers'
  * @param peers array of 'num_peers' with the peers to configure
+ * @param max_connections the maximums number of overlay connections that will
+ *          be made to achieve the given topology
  * @param topo desired underlay topology to use
  * @param va topology-specific options
  * @return handle to the operation, NULL if connecting these
@@ -1072,6 +1074,7 @@
 GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
                                               unsigned int num_peers,
                                               struct GNUNET_TESTBED_Peer 
**peers,
+                                              unsigned int *max_connections,
                                               enum 
GNUNET_TESTBED_TopologyOption topo,
                                               va_list va);
 
@@ -1084,6 +1087,8 @@
  * @param op_cls closure argument to give with the operation event
  * @param num_peers number of peers in 'peers'
  * @param peers array of 'num_peers' with the peers to configure
+ * @param max_connections the maximums number of overlay connections that will
+ *          be made to achieve the given topology
  * @param topo desired underlay topology to use
  * @param ... topology-specific options
  * @return handle to the operation, NULL if connecting these
@@ -1094,6 +1099,7 @@
 GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
                                            unsigned int num_peers,
                                            struct GNUNET_TESTBED_Peer **peers,
+                                           unsigned int *max_connections,
                                            enum GNUNET_TESTBED_TopologyOption 
topo,
                                            ...);
 

Modified: gnunet/src/mesh/gnunet-regex-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-regex-profiler.c     2012-11-20 12:02:01 UTC (rev 
25066)
+++ gnunet/src/mesh/gnunet-regex-profiler.c     2012-11-20 12:29:57 UTC (rev 
25067)
@@ -1109,6 +1109,7 @@
   prof_start_time = GNUNET_TIME_absolute_get ();
   topology_op =
     GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles,
+                                               NULL,
                                                
GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
                                                num_links,
                                                
GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,

Modified: gnunet/src/testbed/gnunet-testbed-profiler.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-profiler.c        2012-11-20 12:02:01 UTC 
(rev 25066)
+++ gnunet/src/testbed/gnunet-testbed-profiler.c        2012-11-20 12:29:57 UTC 
(rev 25067)
@@ -345,7 +345,7 @@
     {
     case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
       topology_op =
-          GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers,
+          GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, 
NULL,
                                                      topology,
                                                      num_links,
                                                      
GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
@@ -353,7 +353,7 @@
       break;
     case GNUNET_TESTBED_TOPOLOGY_CLIQUE:
       topology_op =
-          GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers,
+          GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, 
NULL,
                                                      topology,
                                                      
GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
                                                      
GNUNET_TESTBED_TOPOLOGY_OPTION_END);

Modified: gnunet/src/testbed/test_testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_topology.c      2012-11-20 12:02:01 UTC 
(rev 25066)
+++ gnunet/src/testbed/test_testbed_api_topology.c      2012-11-20 12:29:57 UTC 
(rev 25067)
@@ -134,7 +134,7 @@
     GNUNET_assert (NULL != peers_[peer]);
   peers = peers_;
   overlay_connects = 0;
-  op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers,
+  op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL,
                                                  
GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
                                                   NUM_PEERS, 
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
   GNUNET_assert (NULL != op);

Modified: gnunet/src/testbed/test_testbed_api_topology_clique.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_topology_clique.c       2012-11-20 
12:02:01 UTC (rev 25066)
+++ gnunet/src/testbed/test_testbed_api_topology_clique.c       2012-11-20 
12:29:57 UTC (rev 25067)
@@ -130,6 +130,7 @@
   peers = peers_;
   overlay_connects = 0;
   op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers,
+                                                  NULL,
                                                   
GNUNET_TESTBED_TOPOLOGY_CLIQUE,
                                                  /* 
GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */
                                                   /* NUM_PEERS, */ 

Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c    2012-11-20 12:02:01 UTC (rev 
25066)
+++ gnunet/src/testbed/testbed_api_testbed.c    2012-11-20 12:29:57 UTC (rev 
25067)
@@ -217,6 +217,11 @@
    * Expected overlay connects. Should be zero if no topology is relavant
    */
   unsigned int num_oc;
+
+  /**
+   * Number of random links to established
+   */
+  unsigned int random_links;
   
 };
 
@@ -444,29 +449,13 @@
          || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology)
          || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology))
     {
-      unsigned int rand_links;
-      
-      switch (rc->topology)
-      {
-      case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
-        rand_links = rc->num_oc;
-        break;
-      case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING:
-        rand_links = rc->num_oc - rc->num_peers;
-        break;
-      case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD:
-        rand_links = GNUNET_TESTBED_2dtorus_calc_links (rc->num_peers, NULL, 
NULL);
-        break;
-      default:
-        GNUNET_break (0);
-        rand_links = 0;
-      }
       rc->topology_operation =
           GNUNET_TESTBED_overlay_configure_topology (NULL,
                                                      rc->num_peers,
                                                      rc->peers,
+                                                     &rc->num_oc,
                                                      rc->topology,
-                                                     rand_links,
+                                                     rc->random_links,
                                                      
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
     }
     else
@@ -474,6 +463,7 @@
           GNUNET_TESTBED_overlay_configure_topology (NULL,
                                                      rc->num_peers,
                                                      rc->peers,
+                                                     &rc->num_oc,
                                                      rc->topology,
                                                      
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
     if (NULL == rc->topology_operation)
@@ -672,32 +662,26 @@
     else if (0 == strcasecmp (topology, "SMALL_WORLD_RING"))
     {
       rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING;
-      rc->num_oc = num_peers;
     }
     else if (0 == strcasecmp (topology, "SMALL_WORLD"))
     {
       rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD;
-      rc->num_oc = GNUNET_TESTBED_2dtorus_calc_links (num_peers, NULL, NULL);
     }
     else if (0 == strcasecmp (topology, "CLIQUE"))
     {
       rc->topology = GNUNET_TESTBED_TOPOLOGY_CLIQUE;
-      rc->num_oc = num_peers * (num_peers - 1);
     }
     else if (0 == strcasecmp (topology, "LINE"))
     {
       rc->topology = GNUNET_TESTBED_TOPOLOGY_LINE;
-      rc->num_oc = num_peers - 1;
     }
     else if (0 == strcasecmp (topology, "RING"))
     {
       rc->topology = GNUNET_TESTBED_TOPOLOGY_RING;
-      rc->num_oc = num_peers;
     }
     else if (0 == strcasecmp (topology, "2D_TORUS"))
     {
       rc->topology = GNUNET_TESTBED_TOPOLOGY_2D_TORUS;
-      rc->num_oc = GNUNET_TESTBED_2dtorus_calc_links (num_peers, NULL, NULL);
     }
     else
       LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -724,7 +708,7 @@
       GNUNET_free (rc);
       return;
     }
-    rc->num_oc += (unsigned int) random_links;
+    rc->random_links = (unsigned int) random_links;
   }
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
                                 &shutdown_run_task, rc);

Modified: gnunet/src/testbed/testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/testbed_api_topology.c   2012-11-20 12:02:01 UTC (rev 
25066)
+++ gnunet/src/testbed/testbed_api_topology.c   2012-11-20 12:29:57 UTC (rev 
25067)
@@ -527,6 +527,8 @@
  * @param op_cls closure argument to give with the operation event
  * @param num_peers number of peers in 'peers'
  * @param peers array of 'num_peers' with the peers to configure
+ * @param max_connections the maximums number of overlay connections that will
+ *          be made to achieve the given topology
  * @param topo desired underlay topology to use
  * @param va topology-specific options
  * @return handle to the operation, NULL if connecting these
@@ -537,6 +539,7 @@
 GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
                                               unsigned int num_peers,
                                               struct GNUNET_TESTBED_Peer 
**peers,
+                                              unsigned int *max_connections,
                                               enum 
GNUNET_TESTBED_TopologyOption
                                               topo, va_list va)
 {
@@ -637,6 +640,8 @@
   GNUNET_TESTBED_operation_queue_insert_
       (c->opq_parallel_topology_config_operations, op);
   GNUNET_TESTBED_operation_begin_wait_ (op);
+  if (NULL != max_connections)
+    *max_connections = tc->link_array_size;
   return op;
 }
 
@@ -649,6 +654,8 @@
  * @param op_cls closure argument to give with the operation event
  * @param num_peers number of peers in 'peers'
  * @param peers array of 'num_peers' with the peers to configure
+ * @param max_connections the maximums number of overlay connections that will
+ *          be made to achieve the given topology
  * @param topo desired underlay topology to use
  * @param ... topology-specific options
  * @return handle to the operation, NULL if connecting these
@@ -658,6 +665,7 @@
 struct GNUNET_TESTBED_Operation *
 GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int 
num_peers,
                                            struct GNUNET_TESTBED_Peer **peers,
+                                           unsigned int *max_connections,
                                            enum GNUNET_TESTBED_TopologyOption
                                            topo, ...)
 {
@@ -667,7 +675,8 @@
   GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END);
   va_start (vargs, topo);
   op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers,
-                                                    topo, vargs);
+                                                    max_connections,
+                                                     topo, vargs);
   va_end (vargs);
   return op;
 }




reply via email to

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