gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r12907 - gnunet/src/testing
Date: Tue, 7 Sep 2010 16:34:47 +0200

Author: nevans
Date: 2010-09-07 16:34:47 +0200 (Tue, 07 Sep 2010)
New Revision: 12907

Modified:
   gnunet/src/testing/testing_group.c
Log:
support for running stats and peerinfo services per host (or multipler per 
host) instead of per peer

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2010-09-07 14:33:14 UTC (rev 12906)
+++ gnunet/src/testing/testing_group.c  2010-09-07 14:34:47 UTC (rev 12907)
@@ -474,6 +474,7 @@
   const char *hostname;
   unsigned int nport;
   unsigned int upnum;
+  unsigned int fdnum;
 };
 
 
@@ -690,6 +691,8 @@
   char cval[12];
   char uval[128];
   char *single_variable;
+  char *per_host_variable;
+  unsigned long long num_per_host;
 
   if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
     {
@@ -706,6 +709,7 @@
   if (0 == strcmp (option, "UNIXPATH"))
     {
       GNUNET_asprintf(&single_variable, "single_%s_per_host", section);
+      GNUNET_asprintf(&per_host_variable, "num_%s_per_host", section);
       if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno(ctx->orig, 
"testing", single_variable))
         {
           GNUNET_snprintf (uval,
@@ -715,6 +719,15 @@
                            ctx->upnum++);
           value = uval;
         }
+      else if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_number(ctx->orig, 
"testing", per_host_variable, &num_per_host))
+        {
+          GNUNET_snprintf (uval,
+                           sizeof (uval),
+                           "/tmp/test-service-%s-%u",
+                           section,
+                           ctx->fdnum % num_per_host);
+          value = uval;
+        }
       GNUNET_free(single_variable);
 
     }
@@ -739,6 +752,8 @@
  *             port numbers that were used
  * @param upnum number to make unix domain socket names unique
  * @param hostname hostname of the controlling host, to allow control 
connections from
+ * @param fdnum number used to offset the unix domain socket for grouped 
processes
+ *              (such as statistics or peerinfo, which can be shared among 
others)
  *
  * @return new configuration, NULL on error
  */
@@ -746,7 +761,7 @@
 make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, 
             uint16_t * port,
             uint32_t * upnum,
-            const char *hostname)
+            const char *hostname, uint32_t * fdnum)
 {
   struct UpdateContext uc;
   uint16_t orig;
@@ -756,6 +771,7 @@
   orig = *port;
   uc.nport = *port;
   uc.upnum = *upnum;
+  uc.fdnum = *fdnum;
   uc.ret = GNUNET_CONFIGURATION_create ();
   uc.hostname = hostname;
   uc.orig = cfg;
@@ -802,6 +818,8 @@
 
   *port = (uint16_t) uc.nport;
   *upnum = uc.upnum;
+  uc.fdnum++;
+  *fdnum = uc.fdnum;
   return uc.ret;
 }
 
@@ -3377,6 +3395,7 @@
   unsigned int hostcnt;
   uint16_t minport;
   uint32_t upnum;
+  uint32_t fdnum;
 
   if (0 == total)
     {
@@ -3384,6 +3403,7 @@
       return NULL;
     }
   upnum = 0;
+  fdnum = 0;
   pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup));
   pg->sched = sched;
   pg->cfg = cfg;
@@ -3478,7 +3498,7 @@
           pcfg = make_config (cfg, 
                              &pg->hosts[off % hostcnt].minport,
                              &upnum,
-                             hostname);
+                             hostname, &fdnum);
         }
       else
         {
@@ -3486,7 +3506,7 @@
           pcfg = make_config (cfg,
                              &minport,
                              &upnum,
-                             hostname);
+                             hostname, &fdnum);
         }
 
       if (NULL == pcfg)




reply via email to

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