/*
* This file is part of GNUnet
- * Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ * Copyright (C) 2013 GNUnet e.V.
*
* GNUnet is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* Terminate the test case (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the test case (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
res = 0;
cleanup ();
}
-void
-tmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+tmit_resume (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n");
struct TransmitClosure *tmit = cls;
if (NULL != tmit->orig_tmit)
GNUNET_MULTICAST_origin_to_all_resume (tmit->orig_tmit);
- else
+ else if (NULL != tmit->mem_tmit)
GNUNET_MULTICAST_member_to_origin_resume (tmit->mem_tmit);
}
uint16_t size = strlen (tmit->data[tmit->n]);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmit notify data: %u bytes available, "
- "processing fragment %u/%u (size %u).\n",
- *data_size, tmit->n + 1, tmit->data_count, size);
+ "Transmit notify data: %u bytes available, processing fragment %u/%u (size %u).\n",
+ (unsigned int) *data_size,
+ tmit->n + 1,
+ tmit->data_count,
+ size);
if (*data_size < size)
{
*data_size = 0;
static void
-schedule_origin_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_origin_stop (void *cls)
{
test = TEST_ORIGIN_STOP;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
break;
case TEST_MEMBER_PART:
- GNUNET_SCHEDULER_add_now (schedule_origin_stop, NULL);
+ GNUNET_SCHEDULER_add_now (&schedule_origin_stop, NULL);
break;
default:
static void
-schedule_member_part (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_member_part (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test #%u: schedule_member_part()\n", test);
test = TEST_MEMBER_PART;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: member_part()\n", test);
- GNUNET_SCHEDULER_add_now (schedule_member_part, NULL);
+ GNUNET_SCHEDULER_add_now (&schedule_member_part, NULL);
}
replay_fragment_id = 1;
replay_flags = 1 | 1<<11;
GNUNET_MULTICAST_member_replay_fragment (member, replay_fragment_id,
- replay_flags, NULL, NULL);
+ replay_flags);
}
replay_fragment_id = 1234;
replay_flags = 11 | 1<<11;
GNUNET_MULTICAST_member_replay_fragment (member, replay_fragment_id,
- replay_flags, NULL, NULL);
+ replay_flags);
}
if (++ocls->n != ocls->msgs_expected)
return;
- GNUNET_assert (0 == memcmp (&req->member_key,
+ GNUNET_assert (0 == memcmp (&req->member_pub_key,
&member_pub_key, sizeof (member_pub_key)));
*tmit = (struct TransmitClosure) {};
tmit->data[0] = "abc def";
tmit->data[1] = "ghi jkl mno";
- tmit->data_delay[1] = 1;
+ tmit->data_delay[1] = 2;
tmit->data[2] = "pqr stuw xyz";
tmit->data_count = 3;
origin_cls.n = 0;
origin_cls.msgs_expected = 1;
- GNUNET_MULTICAST_member_to_origin (member, 1, tmit_notify, tmit);
+ tmit->mem_tmit = GNUNET_MULTICAST_member_to_origin (member, 1,
+ tmit_notify, tmit);
}
const struct GNUNET_MULTICAST_MessageHeader *msg)
{
struct MemberClosure *mcls = cls;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test #%u: member_recv_message() %u/%u\n",
- test, mcls->n + 1, mcls->msgs_expected);
+ test,
+ (unsigned int) (mcls->n + 1),
+ mcls->msgs_expected);
if (++mcls->n != mcls->msgs_expected)
return;
struct TransmitClosure *tmit = &tmit_cls;
*tmit = (struct TransmitClosure) {};
tmit->data[0] = "ABC DEF";
- tmit->data[1] = "GHI JKL MNO";
- tmit->data_delay[1] = 1;
- tmit->data[2] = "PQR STUW XYZ";
- tmit->data_count = 3;
+ tmit->data[1] = GNUNET_malloc (GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD + 1);
+ uint16_t i;
+ for (i = 0; i < GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD; i++)
+ tmit->data[1][i] = (0 == i % 10000) ? '0' + i / 10000 : '_';
+ tmit->data[2] = "GHI JKL MNO";
+ tmit->data_delay[2] = 2;
+ tmit->data[3] = "PQR STUW XYZ";
+ tmit->data_count = 4;
origin_cls.n = member_cls.n = 0;
- origin_cls.msgs_expected = member_cls.msgs_expected = 1;
+ origin_cls.msgs_expected = member_cls.msgs_expected = tmit->data_count;
- GNUNET_MULTICAST_origin_to_all (origin, 1, 1, tmit_notify, tmit);
+ tmit->orig_tmit = GNUNET_MULTICAST_origin_to_all (origin, 1, 1,
+ tmit_notify, tmit);
}
{
case TEST_MEMBER_JOIN_REFUSE:
GNUNET_assert (0 == relay_count);
- GNUNET_SCHEDULER_add_now (schedule_member_part, NULL);
+ GNUNET_SCHEDULER_add_now (&schedule_member_part, NULL);
break;
case TEST_MEMBER_JOIN_ADMIT:
*/
static void
#if DEBUG_TEST_MULTICAST
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
#else
run (void *cls,
#endif
{
cfg = c;
- end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
-
- core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL,
- NULL, GNUNET_NO, NULL, GNUNET_NO, NULL);
+ end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &end_badly, NULL);
+ core = GNUNET_CORE_connect (cfg, NULL,
+ &core_connected, NULL, NULL,
+ NULL, GNUNET_NO,
+ NULL, GNUNET_NO,
+ NULL);
}