#include "gnunet_core_service.h"
#include "gnunet_dht_service.h"
-/* DEFINES */
-#define VERBOSE GNUNET_NO
-
/* Timeout for entire testcase */
#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 30)
{"core", "# bytes encrypted", 0},
{"core", "# type maps received", 0},
{"core", "# session keys confirmed via PONG", 0},
- {"core", "# entries in session map", 0},
+ {"core", "# peers connected", 0},
{"core", "# key exchanges initiated", 0},
{"core", "# send requests dropped (disconnected)", 0},
{"core", "# transmissions delayed due to corking", 0},
get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct TestGetContext *test_get = cls;
- GNUNET_HashCode search_key; /* Key stored under */
+ struct GNUNET_HashCode search_key; /* Key stored under */
char original_data[TEST_DATA_SIZE]; /* Made up data to store */
test_get->task = GNUNET_SCHEDULER_NO_TASK;
*/
static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
size_t size, const void *data)
{
struct TestGetContext *test_get = cls;
- GNUNET_HashCode search_key; /* Key stored under */
+ struct GNUNET_HashCode search_key; /* Key stored under */
char original_data[TEST_DATA_SIZE]; /* Made up data to store */
memset (original_data, test_get->uid, sizeof (original_data));
}
#endif
- if ((0 != memcmp (&search_key, key, sizeof (GNUNET_HashCode))) ||
+ if ((0 != memcmp (&search_key, key, sizeof (struct GNUNET_HashCode))) ||
(0 != memcmp (original_data, data, sizeof (original_data))))
{
FPRINTF (stderr, "%s", "Key or data is not the same as was inserted!\n");
do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct TestGetContext *test_get = cls;
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[TEST_DATA_SIZE]; /* Made up data to store */
if (outstanding_gets > MAX_OUTSTANDING_GETS)
GNUNET_assert (test_get->dht_handle != NULL);
outstanding_gets++;
test_get->get_handle =
- GNUNET_DHT_get_start (test_get->dht_handle, GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_DHT_get_start (test_get->dht_handle,
GNUNET_BLOCK_TYPE_TEST, &key, 1, route_option, NULL,
0, &get_result_iterator, test_get);
test_get->task =
unsigned long long j;
struct TestGetContext *test_get;
-#if VERBOSE
- FPRINTF (stderr, "Issuing %llu GETs\n",
- (unsigned long long) (num_peers * num_peers));
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Issuing %llu GETs\n",
+ (unsigned long long) (num_peers * num_peers));
for (i = 0; i < num_peers; i++)
for (j = 0; j < num_peers; j++)
{
do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct TestPutContext *test_put = cls;
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[TEST_DATA_SIZE]; /* Made up data to store */
test_put->task = GNUNET_SCHEDULER_NO_TASK;
test_put->dht_handle = GNUNET_DHT_connect (test_put->daemon->cfg, 10);
GNUNET_assert (test_put->dht_handle != NULL);
outstanding_puts++;
-#if VERBOSE > 2
- FPRINTF (stderr, "PUT %u at `%s'\n", test_put->uid,
- GNUNET_i2s (&test_put->daemon->id));
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "PUT %u at `%s'\n", test_put->uid,
+ GNUNET_i2s (&test_put->daemon->id));
GNUNET_DHT_put (test_put->dht_handle, &key, 1, route_option,
GNUNET_BLOCK_TYPE_TEST, sizeof (data), data,
GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_REL,
return;
}
if (GNUNET_SYSERR ==
- GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
+ GNUNET_CONFIGURATION_get_value_number (cfg, "testing_old", "num_peers",
&num_peers))
num_peers = DEFAULT_NUM_PEERS;
pg = GNUNET_TESTING_peergroup_start (cfg, num_peers, TIMEOUT, NULL,
char *const argv[] = { "test-dht-multipeer", /* Name to give running binary */
"-c",
"test_dht_multipeer_data.conf", /* Config file to use */
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
{
int ret;
-
GNUNET_log_setup ("test-dht-multipeer",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
/**