}
static unsigned int
-get_peer_nr()
+get_peer_nr(int outgoing)
{
if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
{
- return peers_running - 1;
+ return GNUNET_YES == outgoing ? 0 : peers_running - 1;
}else
{
- return 0;
+ return GNUNET_YES == outgoing ? peers_running -1 : 0;
}
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"requesting peers info!\n");
- plo = GNUNET_CADET_list_peers (p_cfg[get_peer_nr()], &peers_callback, NULL);
+ plo = GNUNET_CADET_list_peers (p_cfg[get_peer_nr(GNUNET_YES)], &peers_callback, NULL);
}
{
const struct GNUNET_PeerIdentity *p_id;
+ const struct GNUNET_PeerIdentity *peer;
+
+
+ peer = &ple->peer;
if (NULL == ple)
{
p_id = get_from_p_ids();
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "peer %s equal to peer %s?",
- GNUNET_i2s_full (&ple->peer),
+ "ple->peer %s\n",
GNUNET_i2s_full (&ple->peer));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "p_id %s\n",
+ GNUNET_i2s_full (p_id));
- if (p_id == &ple->peer && ple->have_tunnel)
+ if (0 == GNUNET_memcmp (&ple->peer, p_id ) && ple->have_tunnel)
{
-
- if (NULL != get_peers_task)
- {
- GNUNET_SCHEDULER_cancel (get_peers_task);
- plo = NULL;
- get_peers_task = GNUNET_SCHEDULER_add_now (&get_peers,
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "schedule get_peers again?\n");
+ get_peers_task = GNUNET_SCHEDULER_add_now (&get_peers,
NULL);
- }
+
}
- else if (p_id == &ple->peer)
+ else if (0 == GNUNET_memcmp (&ple->peer, p_id) )
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "reopen channel\n");
+
reopen_channel ();
}
ok,
ok_goal);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TEST both IDs: %s,%s\n",
- GNUNET_i2s (testpeer_id[0]),
+ "TEST ID 0: %s\n",
+ GNUNET_i2s (testpeer_id[0]));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "TEST ID 1: %s\n",
GNUNET_i2s (testpeer_id[1]));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "dropping message\n");
ok,
ok_goal);
- if (peer == get_peer_nr())
+ if (peer == get_peer_nr(GNUNET_NO))
{
if (DESTROY != test && NULL != incoming_ch)
{
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got all peer information, starting test\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "TEST ID 0: %s\n",
+ GNUNET_i2s (testpeer_id[0]));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "TEST ID 1: %s\n",
+ GNUNET_i2s (testpeer_id[1]));
test_task = GNUNET_SCHEDULER_add_now (&start_test, NULL);
}
test = DESTROY;
test_name = "destroy";
ok_goal = 5;
+ short_time = GNUNET_TIME_relative_multiply (short_time, 5);
}
else
{