aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/testing/testing_group.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 61e8675b1..622afcd63 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -474,6 +474,7 @@ struct UpdateContext
474 const char *hostname; 474 const char *hostname;
475 unsigned int nport; 475 unsigned int nport;
476 unsigned int upnum; 476 unsigned int upnum;
477 unsigned int fdnum;
477}; 478};
478 479
479 480
@@ -690,6 +691,8 @@ update_config (void *cls,
690 char cval[12]; 691 char cval[12];
691 char uval[128]; 692 char uval[128];
692 char *single_variable; 693 char *single_variable;
694 char *per_host_variable;
695 unsigned long long num_per_host;
693 696
694 if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival))) 697 if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
695 { 698 {
@@ -706,6 +709,7 @@ update_config (void *cls,
706 if (0 == strcmp (option, "UNIXPATH")) 709 if (0 == strcmp (option, "UNIXPATH"))
707 { 710 {
708 GNUNET_asprintf(&single_variable, "single_%s_per_host", section); 711 GNUNET_asprintf(&single_variable, "single_%s_per_host", section);
712 GNUNET_asprintf(&per_host_variable, "num_%s_per_host", section);
709 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno(ctx->orig, "testing", single_variable)) 713 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno(ctx->orig, "testing", single_variable))
710 { 714 {
711 GNUNET_snprintf (uval, 715 GNUNET_snprintf (uval,
@@ -715,6 +719,15 @@ update_config (void *cls,
715 ctx->upnum++); 719 ctx->upnum++);
716 value = uval; 720 value = uval;
717 } 721 }
722 else if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_number(ctx->orig, "testing", per_host_variable, &num_per_host))
723 {
724 GNUNET_snprintf (uval,
725 sizeof (uval),
726 "/tmp/test-service-%s-%u",
727 section,
728 ctx->fdnum % num_per_host);
729 value = uval;
730 }
718 GNUNET_free(single_variable); 731 GNUNET_free(single_variable);
719 732
720 } 733 }
@@ -739,6 +752,8 @@ update_config (void *cls,
739 * port numbers that were used 752 * port numbers that were used
740 * @param upnum number to make unix domain socket names unique 753 * @param upnum number to make unix domain socket names unique
741 * @param hostname hostname of the controlling host, to allow control connections from 754 * @param hostname hostname of the controlling host, to allow control connections from
755 * @param fdnum number used to offset the unix domain socket for grouped processes
756 * (such as statistics or peerinfo, which can be shared among others)
742 * 757 *
743 * @return new configuration, NULL on error 758 * @return new configuration, NULL on error
744 */ 759 */
@@ -746,7 +761,7 @@ static struct GNUNET_CONFIGURATION_Handle *
746make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, 761make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
747 uint16_t * port, 762 uint16_t * port,
748 uint32_t * upnum, 763 uint32_t * upnum,
749 const char *hostname) 764 const char *hostname, uint32_t * fdnum)
750{ 765{
751 struct UpdateContext uc; 766 struct UpdateContext uc;
752 uint16_t orig; 767 uint16_t orig;
@@ -756,6 +771,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
756 orig = *port; 771 orig = *port;
757 uc.nport = *port; 772 uc.nport = *port;
758 uc.upnum = *upnum; 773 uc.upnum = *upnum;
774 uc.fdnum = *fdnum;
759 uc.ret = GNUNET_CONFIGURATION_create (); 775 uc.ret = GNUNET_CONFIGURATION_create ();
760 uc.hostname = hostname; 776 uc.hostname = hostname;
761 uc.orig = cfg; 777 uc.orig = cfg;
@@ -802,6 +818,8 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
802 818
803 *port = (uint16_t) uc.nport; 819 *port = (uint16_t) uc.nport;
804 *upnum = uc.upnum; 820 *upnum = uc.upnum;
821 uc.fdnum++;
822 *fdnum = uc.fdnum;
805 return uc.ret; 823 return uc.ret;
806} 824}
807 825
@@ -3377,6 +3395,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
3377 unsigned int hostcnt; 3395 unsigned int hostcnt;
3378 uint16_t minport; 3396 uint16_t minport;
3379 uint32_t upnum; 3397 uint32_t upnum;
3398 uint32_t fdnum;
3380 3399
3381 if (0 == total) 3400 if (0 == total)
3382 { 3401 {
@@ -3384,6 +3403,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
3384 return NULL; 3403 return NULL;
3385 } 3404 }
3386 upnum = 0; 3405 upnum = 0;
3406 fdnum = 0;
3387 pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup)); 3407 pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup));
3388 pg->sched = sched; 3408 pg->sched = sched;
3389 pg->cfg = cfg; 3409 pg->cfg = cfg;
@@ -3478,7 +3498,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
3478 pcfg = make_config (cfg, 3498 pcfg = make_config (cfg,
3479 &pg->hosts[off % hostcnt].minport, 3499 &pg->hosts[off % hostcnt].minport,
3480 &upnum, 3500 &upnum,
3481 hostname); 3501 hostname, &fdnum);
3482 } 3502 }
3483 else 3503 else
3484 { 3504 {
@@ -3486,7 +3506,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
3486 pcfg = make_config (cfg, 3506 pcfg = make_config (cfg,
3487 &minport, 3507 &minport,
3488 &upnum, 3508 &upnum,
3489 hostname); 3509 hostname, &fdnum);
3490 } 3510 }
3491 3511
3492 if (NULL == pcfg) 3512 if (NULL == pcfg)