[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r36123 - gnunet/src/rps
From: |
gnunet |
Subject: |
[GNUnet-SVN] r36123 - gnunet/src/rps |
Date: |
Thu, 23 Jul 2015 20:23:39 +0200 |
Author: ch3
Date: 2015-07-23 20:23:39 +0200 (Thu, 23 Jul 2015)
New Revision: 36123
Modified:
gnunet/src/rps/test_rps.c
Log:
get indices for evaluation with diehard
Modified: gnunet/src/rps/test_rps.c
===================================================================
--- gnunet/src/rps/test_rps.c 2015-07-23 18:21:52 UTC (rev 36122)
+++ gnunet/src/rps/test_rps.c 2015-07-23 18:23:39 UTC (rev 36123)
@@ -159,6 +159,11 @@
static struct RPSPeer *rps_peers;
/**
+ * Peermap to get the index of a given peer ID quick.
+ */
+static struct GNUNET_CONTAINER_MultiPeerMap *peer_map;
+
+/**
* IDs of the peers.
*/
static struct GNUNET_PeerIdentity *rps_peer_ids;
@@ -326,6 +331,7 @@
tofile_(file_name,tmp_buf);\
} while (0);
+
/**
* Write the ids and their according index in the given array to a file
* Unused
@@ -529,6 +535,11 @@
rps_peers[entry->index].rec_ids = NULL;
rps_peers[entry->index].num_rec_ids = 0;
+ GNUNET_CONTAINER_multipeermap_put (peer_map,
+ &rps_peer_ids[entry->index],
+ &rps_peers[entry->index],
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+
tofile ("/tmp/rps/peer_ids",
"%u\t%s\n",
entry->index,
@@ -962,10 +973,13 @@
const struct GNUNET_PeerIdentity *recv_peers)
{
struct RPSPeer *rps_peer = (struct RPSPeer *) cls;
+ struct RPSPeer *rcv_rps_peer;
char *file_name;
+ char *file_name_dh;
unsigned int i;
file_name = "/tmp/rps/received_ids";
+ file_name_dh = "/tmp/rps/diehard_input";
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"[%s] got %" PRIu64 " peers:\n",
@@ -983,6 +997,12 @@
tofile (file_name,
"%s\n",
GNUNET_i2s_full (&recv_peers[i]));
+
+ rcv_rps_peer = GNUNET_CONTAINER_multipeermap_get (peer_map,
&recv_peers[i]);
+
+ tofile (file_name_dh,
+ "%" PRIu32 "\n",
+ (uint32_t) rcv_rps_peer->index);
}
}
@@ -1153,6 +1173,8 @@
int
main (int argc, char *argv[])
{
+ int ret_value;
+
cur_test_run.name = "test-rps-default";
cur_test_run.pre_test = NULL;
cur_test_run.reply_handle = default_reply_handle;
@@ -1259,6 +1281,7 @@
rps_peers = GNUNET_new_array (num_peers, struct RPSPeer);
rps_peer_ids = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
+ peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO);
ok = 1;
(void) GNUNET_TESTBED_test_run (cur_test_run.name,
@@ -1267,7 +1290,13 @@
0, NULL, NULL,
&run, NULL);
- return cur_test_run.eval_cb();
+ ret_value = cur_test_run.eval_cb();
+
+ GNUNET_free (rps_peers );
+ GNUNET_free (rps_peer_ids);
+ GNUNET_CONTAINER_multipeermap_destroy (peer_map);
+
+ return ret_value;
}
/* end of test_rps_multipeer.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r36123 - gnunet/src/rps,
gnunet <=