*/
static struct GNUNET_SCHEDULER_Task *send_next_msg_task;
-/**
- * Cadet handle for the root peer
- */
-static struct GNUNET_CADET_Handle *h1;
-
/**
* Channel handle for the root peer
*/
*/
static struct GNUNET_TESTBED_Peer **testbed_peers;
+
+struct GNUNET_CADET_Handle **cadets_running;
+
/**
* Statistics operation handle.
*/
disconnect_handler (void *cls,
const struct GNUNET_CADET_Channel *channel);
+static struct GNUNET_PeerIdentity *
+get_from_p_ids()
+{
+ if (0 < GNUNET_memcmp (p_id[0], p_id[1]))
+ {
+ return p_id[1];
+ }else
+ {
+ return p_id[0];
+ }
+}
+
+static struct GNUNET_CADET_Handle *
+get_from_cadets()
+{
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "1\n");
+ if (0 < GNUNET_memcmp (p_id[0], p_id[1]))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "standard peer\n");
+ return cadets_running[0];
+ }else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "the other peer\n");
+ return cadets_running[peers_running - 1];
+ }
+
+}
/**
* Task to reconnect to other peer.
};
long l = (long) cls;
struct CadetTestChannelWrapper *ch;
-
+ static struct GNUNET_PeerIdentity *p_id;
+ static struct GNUNET_CADET_Handle *h1;
+
reconnect_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"reconnecting from line %ld\n",
outgoing_ch = NULL;
}
ch = GNUNET_new (struct CadetTestChannelWrapper);
+
+ p_id = get_from_p_ids();
+ h1 = get_from_cadets();
+
outgoing_ch = GNUNET_CADET_channel_create (h1,
ch,
- p_id[1],
+ p_id,
&port,
NULL,
&disconnect_handler,
GNUNET_MQ_handler_end ()
};
struct CadetTestChannelWrapper *ch;
+ static struct GNUNET_PeerIdentity *p_id;
+ static struct GNUNET_CADET_Handle *h1;
test_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "start_test: %s\n", test_name);
test = SPEED;
}
+ p_id = get_from_p_ids();
+ h1 = get_from_cadets();
+
ch = GNUNET_new (struct CadetTestChannelWrapper);
outgoing_ch = GNUNET_CADET_channel_create (h1,
ch,
- p_id[1],
+ p_id,
&port,
NULL,
&disconnect_handler,
handlers);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "channel created\n");
ch->ch = outgoing_ch;
- /*if (DESTROY == test)
+ 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[1],
+ p_id,
&port,
NULL,
&disconnect_handler,
ch->ch = outgoing_ch;
- }*/
+ }
disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time,
peers_running = num_peers;
GNUNET_assert (peers_running == peers_requested);
testbed_peers = peers;
- if (0 < GNUNET_memcmp (p_id[0], p_id[num_peers - 1]))
- {
- h1 = cadets[0];
- }else
- {
- h1 = cadets[num_peers - 1];
- }
+ cadets_running = cadets;
+
disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time,
&disconnect_cadet_peers,
(void *) __LINE__);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
+
t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
GNUNET_TESTBED_PIT_IDENTITY,
&pi_cb,
(void *) 0L);
+
t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
GNUNET_TESTBED_PIT_IDENTITY,
&pi_cb,