4 my $max_outstanding = 300;
6 $ARGV[0] || die "No directory provided for peer information, exiting!\n";
8 my $directory = $ARGV[0];
9 my @config_files = `find $directory -iname gnunet-testing-config*`;
13 foreach my $file (@config_files)
16 #print "Starting GNUnet peer with config file $file\n";
24 exec "gnunet-arm -q -c $file -s" or die;
29 push @child_arr, $pid;
32 if ($outstanding > $max_outstanding)
34 for (my $i = 0; $i < $max_outstanding / 5; $i++)
36 #print "Too many outstanding peers, waiting!\n";
37 waitpid($child_arr[0], 0);
45 print "All $count peers started (waiting for them to finish!\n";
47 while ($outstanding > 0)
49 waitpid($child_arr[0], 0);
52 if ($outstanding % 50 == 0)
54 print "All $count peers started (waiting for $outstanding to finish!\n";
58 while (wait() != -1) {sleep 1}
60 print "All $count peers started!\n";