#define MTYPE 12345
+GNUNET_NETWORK_STRUCT_BEGIN
+
struct GNUNET_TestMessage
{
/**
*/
uint32_t uid;
};
+GNUNET_NETWORK_STRUCT_END
struct TestMessageContext
{
GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", "memsize.pl",
"totals.txt", peer_number, connect_number, NULL);
GNUNET_OS_process_wait (mem_process);
- GNUNET_OS_process_close (mem_process);
+ GNUNET_OS_process_destroy (mem_process);
mem_process = NULL;
}
if (dotOutFile != NULL)
{
- fprintf (dotOutFile, "}");
- fclose (dotOutFile);
+ FPRINTF (dotOutFile, "%s", "}");
+ FCLOSE (dotOutFile);
}
ok = 0;
{
if (outfile != NULL)
{
- fprintf (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
- fprintf (outfile, "\"%s\";\n", GNUNET_i2s (second));
+ FPRINTF (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
+ FPRINTF (outfile, "\"%s\";\n", GNUNET_i2s (second));
}
topology_connections++;
}
else
{
- fprintf (stderr,
+ FPRINTF (stderr,
"Finished iterating over topology, %d total connections!\n",
topology_connections);
if (outfile != NULL)
{
- fprintf (outfile, "}\n");
- fclose (outfile);
+ FPRINTF (outfile, "%s", "}\n");
+ FCLOSE (outfile);
GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
}
}
static int
process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_TRANSPORT_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi)
{
char *dotOutFileNameFinished;
FILE *dotOutFileFinished;
if ((total_messages_received) % modnum == 0)
{
if (total_messages_received == 0)
- fprintf (stdout, "0%%");
+ FPRINTF (stdout, "%s", "0%%");
else
- fprintf (stdout, "%d%%",
+ FPRINTF (stdout, "%d%%",
(int) (((float) total_messages_received / expected_messages) *
100));
}
else if (total_messages_received % dotnum == 0)
{
- fprintf (stdout, ".");
+ FPRINTF (stdout, "%s", ".");
}
fflush (stdout);
#endif
if (total_messages_received == expected_messages)
{
#if VERBOSE
- fprintf (stdout, "100%%]\n");
+ FPRINTF (stdout, "%s", "100%%]\n");
#endif
GNUNET_SCHEDULER_cancel (die_task);
GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
- dotOutFileFinished = fopen (dotOutFileNameFinished, "w");
+ dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w");
GNUNET_free (dotOutFileNameFinished);
if (dotOutFileFinished != NULL)
{
- fprintf (dotOutFileFinished, "strict graph G {\n");
+ FPRINTF (dotOutFileFinished, "%s", "strict graph G {\n");
}
topology_connections = 0;
GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished);
if (dotOutFile != NULL)
{
- fprintf (dotOutFile, "}");
- fclose (dotOutFile);
+ FPRINTF (dotOutFile, "%s", "}");
+ FCLOSE (dotOutFile);
}
}
static void
init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server,
- const struct GNUNET_PeerIdentity *my_identity,
- const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
- *publicKey)
+ const struct GNUNET_PeerIdentity *my_identity)
{
struct TestMessageContext *pos = cls;
*/
static void
connect_notify_peers (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_TRANSPORT_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi)
{
struct TestMessageContext *pos = cls;
static void
init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server,
- const struct GNUNET_PeerIdentity *my_identity,
- const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
- *publicKey)
+ const struct GNUNET_PeerIdentity *my_identity)
{
struct TestMessageContext *pos = cls;
if ((total_connections) % modnum == 0)
{
if (total_connections == 0)
- fprintf (stdout, "0%%");
+ FPRINTF (stdout, "%s", "0%%");
else
- fprintf (stdout, "%d%%",
+ FPRINTF (stdout, "%d%%",
(int) (((float) total_connections / expected_connections) *
100));
}
else if (total_connections % dotnum == 0)
{
- fprintf (stdout, ".");
+ FPRINTF (stdout, "%s", ".");
}
fflush (stdout);
#endif
expected_messages++;
if (dotOutFile != NULL)
- fprintf (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
+ FPRINTF (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
second_daemon->shortname);
}
#if VERBOSE
if (total_connections == expected_connections)
{
#if VERBOSE
- fprintf (stdout, "100%%]\n");
+ FPRINTF (stdout, "%s", "100%%]\n");
#endif
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_NO_TASK;
#if DELAY_FOR_LOGGING
- fprintf (stdout, "Sending test messages in 10 seconds.\n");
+ FPRINTF (stdout, "%s", "Sending test messages in 10 seconds.\n");
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 10),
&send_test_messages, test_messages);
test_messages);
#endif
#if VERBOSE
- fprintf (stdout, "Test message progress: [");
+ FPRINTF (stdout, "%s", "Test message progress: [");
#endif
}
modnum = expected_connections / 4;
dotnum = (expected_connections / 50) + 1;
#if VERBOSE
- fprintf (stdout, "Peer connection progress: [");
+ FPRINTF (stdout, "%s", "Peer connection progress: [");
#endif
}
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Topology set up, now starting peers!\n");
- fprintf (stdout, "Daemon start progress [");
+ FPRINTF (stdout, "%s", "Daemon start progress [");
#endif
GNUNET_TESTING_daemons_continue_startup (pg);
}
if ((num_peers - peers_left) % modnum == 0)
{
if (num_peers - peers_left == 0)
- fprintf (stdout, "0%%");
+ FPRINTF (stdout, "%s", "0%%");
else
- fprintf (stdout, "%d%%",
+ FPRINTF (stdout, "%d%%",
(int) (((float) (num_peers - peers_left) / num_peers) * 100));
}
else if ((num_peers - peers_left) % dotnum == 0)
{
- fprintf (stdout, ".");
+ FPRINTF (stdout, "%s", ".");
}
fflush (stdout);
#endif
if (peers_left == 0)
{
#if VERBOSE
- fprintf (stdout, "100%%]\n");
+ FPRINTF (stdout, "%s", "100%%]\n");
#endif
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_SCHEDULER_add_delayed (timeout, &end_badly,
"from peers_started_callback");
#if DELAY_FOR_LOGGING
- fprintf (stdout, "Connecting topology in 10 seconds\n");
+ FPRINTF (stdout, "%s", "Connecting topology in 10 seconds\n");
gather_log_data ();
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 10),
if ((num_peers - peers_left) % modnum == 0)
{
if (num_peers - peers_left == 0)
- fprintf (stdout, "0%%");
+ FPRINTF (stdout, "%s", "0%%");
else
- fprintf (stdout, "%d%%",
+ FPRINTF (stdout, "%d%%",
(int) (((float) (num_peers - peers_left) / num_peers) * 100));
}
else if ((num_peers - peers_left) % dotnum == 0)
{
- fprintf (stdout, ".");
+ FPRINTF (stdout, "%s", ".");
}
fflush (stdout);
#endif
if (peers_left == 0)
{
#if VERBOSE
- fprintf (stdout, "100%%]\n");
+ FPRINTF (stdout, "%s", "100%%]\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d hostkeys created, now creating topology!\n", num_peers);
#endif
ok = 1;
- dotOutFile = fopen (dotOutFileName, "w");
+ dotOutFile = FOPEN (dotOutFileName, "w");
if (dotOutFile != NULL)
{
- fprintf (dotOutFile, "strict graph G {\n");
+ FPRINTF (dotOutFile, "%s", "strict graph G {\n");
}
#if VERBOSE
"connect_topology_option_modifier",
&connect_topology_option_modifier_string))
{
- if (sscanf
+ if (SSCANF
(connect_topology_option_modifier_string, "%lf",
&connect_topology_option_modifier) != 1)
{
GNUNET_free_non_null (topology_str);
GNUNET_free_non_null (blacklist_topology_str);
- if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "settle_time",
- &temp_settle))
- settle_time =
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
-
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SETTLE_TIME",
+ &settle_time))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
+ "testing", "SETTLE_TIME");
+ return;
+ }
if (GNUNET_SYSERR ==
GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
&num_peers))
num_peers = DEFAULT_NUM_PEERS;
- 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
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "CONNECT_TIMEOUT",
+ &connect_timeout))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
- "testing", "connect_timeout");
+ "testing", "CONNECT_TIMEOUT");
return;
}
modnum = num_peers / 4;
dotnum = (num_peers / 50) + 1;
#if VERBOSE
- fprintf (stdout, "Hostkey generation progress: [");
+ FPRINTF (stdout, "%s", "Hostkey generation progress: [");
#endif
/* Set up a task to end testing if peer start fails */
die_task =