#include "gnunet_core_service.h"
#include "gnunet_os_lib.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
+
+#define PROGRESS_BARS GNUNET_YES
#define DELAY_FOR_LOGGING GNUNET_NO
static unsigned long long num_peers;
+struct GNUNET_TIME_Relative connect_timeout;
+
+static unsigned long long connect_attempts;
+
static unsigned int topology_connections;
static unsigned int total_connections;
if (pos->uid != ntohl (msg->uid))
return GNUNET_OK;
-#if VERBOSE
+#if PROGRESS_BARS
if ((total_messages_received) % modnum == 0)
{
if (total_messages_received == 0)
if (total_messages_received == expected_messages)
{
-#if VERBOSE
+#if PROGRESS_BARS
fprintf (stdout, "100%%]\n");
#endif
GNUNET_SCHEDULER_cancel (die_task);
struct TestMessageContext *temp_context;
if (emsg == NULL)
{
-#if VERBOSE
+#if PROGRESS_BARS
if ((total_connections) % modnum == 0)
{
if (total_connections == 0)
if (total_connections == expected_connections)
{
-#if VERBOSE
+#if PROGRESS_BARS
fprintf (stdout, "100%%]\n");
#endif
#if VERBOSE
#endif
modnum = expected_messages / 4;
dotnum = (expected_messages / 50) + 1;
+ if (modnum == 0)
+ modnum = 1;
+ if (dotnum == 0)
+ dotnum = 1;
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_NO_TASK;
#if DELAY_FOR_LOGGING
GNUNET_SCHEDULER_add_delayed (settle_time, &send_test_messages,
test_messages);
#endif
-#if VERBOSE
+#if PROGRESS_BARS
fprintf (stdout, "Test message progress: [");
#endif
GNUNET_TESTING_connect_topology (pg, connection_topology,
connect_topology_option,
connect_topology_option_modifier,
+ connect_timeout,
+ connect_attempts,
&topology_creation_finished, NULL);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+#if PROGRESS_BARS
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Have %d expected connections\n", expected_connections);
#endif
}
return;
}
- die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT,
+ die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS,
+ SECONDS_PER_PEER_START * num_peers),
&end_badly,
"from connect topology (timeout)");
modnum = expected_connections / 4;
dotnum = (expected_connections / 50) + 1;
-#if VERBOSE
+ if (modnum == 0)
+ modnum = 1;
+ if (dotnum == 0)
+ dotnum = 1;
+#if PROGRESS_BARS
fprintf (stdout, "Peer connection progress: [");
#endif
}
(pg, topology, blacklist_topology,
blacklist_transports) != GNUNET_SYSERR)
{
-#if VERBOSE
+#if PROGRESS_BARS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Topology set up, now starting peers!\n");
fprintf (stdout, "Daemon start progress [");
"from create topology (bad return)");
}
GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT,
+ die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS,
+ SECONDS_PER_PEER_START * num_peers),
&end_badly,
"from continue startup (timeout)");
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
(num_peers - peers_left) + 1, num_peers);
#endif
-#if VERBOSE
+#if PROGRESS_BARS
if ((num_peers - peers_left) % modnum == 0)
{
if (num_peers - peers_left == 0)
peers_left--;
if (peers_left == 0)
{
-#if VERBOSE
+#if PROGRESS_BARS
fprintf (stdout, "100%%]\n");
#endif
#if VERBOSE
num_peers - peers_left, num_peers, GNUNET_i2s (id));
#endif
-#if VERBOSE
+#if PROGRESS_BARS
if ((num_peers - peers_left) % modnum == 0)
{
if (num_peers - peers_left == 0)
peers_left--;
if (peers_left == 0)
{
-#if VERBOSE
+#if PROGRESS_BARS
fprintf (stdout, "100%%]\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d hostkeys created, now creating topology!\n",
char *connect_topology_option_str;
char *connect_topology_option_modifier_string;
unsigned long long temp_settle;
+ unsigned long long max_outstanding_connections;
ok = 1;
dotOutFile = fopen (dotOutFileName, "w");
settle_time =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
+ &temp_settle))
+ connect_timeout =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
+ else
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", "testing", "connect_timeout");
+ return;
+ }
+
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_attempts",
+ &connect_attempts))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", "testing", "connect_attempts");
+ return;
+ }
+
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "max_outstanding_connections",
+ &max_outstanding_connections))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", "testing", "max_outstanding_connections");
+ return;
+ }
+
if (GNUNET_SYSERR ==
GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
&num_peers))
peers_left = num_peers;
modnum = num_peers / 4;
dotnum = (num_peers / 50) + 1;
-#if VERBOSE
+ if (modnum == 0)
+ modnum = 1;
+ if (dotnum == 0)
+ dotnum = 1;
+#if PROGRESS_BARS
fprintf (stdout, "Hostkey generation progress: [");
#endif
/* Set up a task to end testing if peer start fails */
GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1);
pg = GNUNET_TESTING_daemons_start (cfg,
+ peers_left,
+ max_outstanding_connections,
peers_left,
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,