/**
* Peer ids.
*/
-static struct GNUNET_PeerIdentity *p_id[2];
+static struct GNUNET_PeerIdentity *testpeer_id[2];
+
+/**
+ * Peer ids.
+ */
+static struct GNUNET_CONFIGURATION_Handle *p_cfg[2];
/**
* Port ID
/**
* Peer ids counter.
*/
-static unsigned int p_ids;
+static unsigned int peerinfo_task_cnt;
/**
* Is the setup initialized?
static struct GNUNET_PeerIdentity *
get_from_p_ids()
{
- if (0 < GNUNET_memcmp (p_id[0], p_id[1]))
+ if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
{
- return p_id[1];
+ return testpeer_id[1];
}else
{
- return p_id[0];
+ return testpeer_id[0];
}
}
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "1\n");
- if (0 < GNUNET_memcmp (p_id[0], p_id[1]))
+ if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "standard peer\n");
return cadets_running[0];
static unsigned int
get_peer_nr()
{
- if (0 < GNUNET_memcmp (p_id[0], p_id[1]))
+ if (0 < GNUNET_memcmp (testpeer_id[0], testpeer_id[1]))
{
return peers_running - 1;
}else
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"requesting peers info!\n");
- plo = GNUNET_CADET_list_peers (get_from_cadets(), &peers_callback, NULL);
+ plo = GNUNET_CADET_list_peers (p_cfg[get_peer_nr()], &peers_callback, NULL);
}
" ok: (%d/%d)\n",
ok,
ok_goal);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "TEST both IDs: %s,%s\n",
+ GNUNET_i2s (testpeer_id[0]),
+ GNUNET_i2s (testpeer_id[1]));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "dropping message\n");
GNUNET_CADET_drop_message (GNUNET_CADET_get_mq (outgoing_ch),
{
long i = (long) cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "ID callback for %ld\n",
- i);
if ((NULL == pinfo) ||
(NULL != emsg))
{
abort_test (__LINE__);
return;
}
- p_id[i] = pinfo->result.id;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "id: %s\n",
- GNUNET_i2s (p_id[i]));
- p_ids++;
- if (p_ids < 2)
+
+ if (GNUNET_TESTBED_PIT_IDENTITY == pinfo->pit)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ID callback for %ld\n",
+ i);
+ testpeer_id[i] = pinfo->result.id;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "id: %s\n",
+ GNUNET_i2s (testpeer_id[i]));
+ }
+ else if (GNUNET_TESTBED_PIT_CONFIGURATION == pinfo->pit)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "CFG callback for %ld\n",
+ i);
+ p_cfg[i] = pinfo->result.cfg;
+ }
+ else
+ {
+ GNUNET_break (0);
+ }
+
+ peerinfo_task_cnt++;
+ if (peerinfo_task_cnt < 4)
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got all IDs, starting test\n");
+ "Got all peer information, starting test\n");
test_task = GNUNET_SCHEDULER_add_now (&start_test, NULL);
}
GNUNET_TESTBED_PIT_IDENTITY,
&pi_cb,
(void *) 1L);
+ t_op[0] = GNUNET_TESTBED_peer_get_information (peers[0],
+ GNUNET_TESTBED_PIT_CONFIGURATION,
+ &pi_cb,
+ (void *) 0L);
+ t_op[1] = GNUNET_TESTBED_peer_get_information (peers[num_peers - 1],
+ GNUNET_TESTBED_PIT_CONFIGURATION,
+ &pi_cb,
+ (void *) 1L);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requested peer ids\n");
}
GNUNET_asprintf (&test_name, "backwards %s", test_name);
}
- p_ids = 0;
+ peerinfo_task_cnt = 0;
ports[0] = &port;
ports[1] = NULL;
GNUNET_CADET_TEST_ruN ("test_cadet_small",