uint32_t *data;
uint32_t payload;
int *counter;
+ struct GNUNET_MQ_MessageHandler handlers[] = {
+ GNUNET_MQ_hd_var_size (data,
+ GNUNET_MESSAGE_TYPE_DUMMY,
+ struct GNUNET_MessageHeader,
+ NULL),
+ GNUNET_MQ_handler_end ()
+ };
+ static struct GNUNET_CADET_Handle *h1;
+ static struct GNUNET_PeerIdentity *p_id;
ok++;
GNUNET_CADET_receive_done (channel);
payload, *counter);
}
+ if (DESTROY == test)
+ {
+ if (2 == ok)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "dropping message\n");
+ GNUNET_CADET_drop_message (GNUNET_CADET_get_mq (outgoing_ch),
+ outgoing_ch->ccn,
+ GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ GNUNET_CADET_channel_destroy(outgoing_ch);
+
+ ok++;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ " ok: (%d/%d)\n",
+ ok,
+ ok_goal);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "creating channel again\n");
+ p_id = get_from_p_ids();
+ ch = GNUNET_new (struct CadetTestChannelWrapper);
+ outgoing_ch = GNUNET_CADET_channel_create (h1,
+ ch,
+ p_id,
+ &port,
+ NULL,
+ &disconnect_handler,
+ handlers);
+ ch->ch = outgoing_ch;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Sending second test data (after destroying the channel) on channel %p...\n",
+ outgoing_ch);
+ send_test_message (outgoing_ch);
+ }
+ else if (3 == ok)
+ {
+ ok++;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ " ok: (%d/%d)\n",
+ ok,
+ ok_goal);
+ // End of DESTROY test.
+ }
+ }
+
if (GNUNET_NO == initialized)
{
initialized = GNUNET_YES;
&reconnect_op,
(void *) __LINE__);
}
+
/* TODO: cannot return channel as-is, in order to unify the data handlers */
ch = GNUNET_new (struct CadetTestChannelWrapper);
GNUNET_MQ_handler_end ()
};
struct CadetTestChannelWrapper *ch;
- static struct GNUNET_PeerIdentity *p_id;
static struct GNUNET_CADET_Handle *h1;
+ static struct GNUNET_PeerIdentity *p_id;
test_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "start_test: %s\n", test_name);
ch->ch = outgoing_ch;
- if (DESTROY == test)
- {
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "dropping message\n");
- GNUNET_CADET_drop_message (GNUNET_CADET_get_mq (outgoing_ch),
- outgoing_ch->ccn,
- GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying channel\n");
- GNUNET_CADET_channel_destroy(outgoing_ch);
-
- p_id = get_from_p_ids();
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "creating channel again\n");
- outgoing_ch = GNUNET_CADET_channel_create (h1,
- ch,
- p_id,
- &port,
- NULL,
- &disconnect_handler,
- handlers);
-
- ch->ch = outgoing_ch;
-
- }
-
-
disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time,
&gather_stats_and_exit,
(void *) __LINE__);
{
test = DESTROY;
test_name = "destroy";
+ ok_goal = 4;
}
else
{