diff options
author | Julius Bünger <buenger@mytum.de> | 2018-08-26 22:58:05 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-08-26 23:04:03 +0200 |
commit | f7cc48d3e4309507f276cfb028d58f9c5048c469 (patch) | |
tree | 9404f3a3786ab94523f1e87a449afb026851c56d /src/rps | |
parent | b1edf308b38823bacda4e0600377ce633fe89434 (diff) | |
download | gnunet-f7cc48d3e4309507f276cfb028d58f9c5048c469.tar.gz gnunet-f7cc48d3e4309507f276cfb028d58f9c5048c469.zip |
Request samples from multiple peers (rps profiler)
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 79f0fbe2f..073d26ffd 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -476,11 +476,6 @@ static struct GNUNET_PeerIdentity *rps_peer_ids; | |||
476 | static struct GNUNET_PeerIdentity *target_peer; | 476 | static struct GNUNET_PeerIdentity *target_peer; |
477 | 477 | ||
478 | /** | 478 | /** |
479 | * ID of the peer that requests for the evaluation. | ||
480 | */ | ||
481 | static struct RPSPeer *eval_peer; | ||
482 | |||
483 | /** | ||
484 | * Number of online peers. | 479 | * Number of online peers. |
485 | */ | 480 | */ |
486 | static unsigned int num_peers_online; | 481 | static unsigned int num_peers_online; |
@@ -1762,12 +1757,7 @@ churn (void *cls) | |||
1762 | */ | 1757 | */ |
1763 | static void profiler_init_peer (struct RPSPeer *rps_peer) | 1758 | static void profiler_init_peer (struct RPSPeer *rps_peer) |
1764 | { | 1759 | { |
1765 | if (num_peers - 1 == rps_peer->index) | 1760 | rps_peer->num_ids_to_request = cur_test_run.num_requests; |
1766 | { | ||
1767 | rps_peer->num_ids_to_request = cur_test_run.num_requests; | ||
1768 | } else { | ||
1769 | rps_peer->num_ids_to_request = 0; | ||
1770 | } | ||
1771 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer shall request %i peers\n", | 1761 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer shall request %i peers\n", |
1772 | rps_peer->num_ids_to_request); | 1762 | rps_peer->num_ids_to_request); |
1773 | } | 1763 | } |
@@ -1787,19 +1777,32 @@ profiler_reply_handle (void *cls, | |||
1787 | { | 1777 | { |
1788 | struct RPSPeer *rps_peer; | 1778 | struct RPSPeer *rps_peer; |
1789 | struct RPSPeer *rcv_rps_peer; | 1779 | struct RPSPeer *rcv_rps_peer; |
1790 | char *file_name; | 1780 | char file_name_buf[128]; |
1791 | char *file_name_dh; | 1781 | char file_name_dh_buf[128]; |
1792 | char *file_name_dhr; | 1782 | char file_name_dhr_buf[128]; |
1793 | char *file_name_dhru; | 1783 | char file_name_dhru_buf[128]; |
1784 | char *file_name = file_name_buf; | ||
1785 | char *file_name_dh = file_name_dh_buf; | ||
1786 | char *file_name_dhr = file_name_dhr_buf; | ||
1787 | char *file_name_dhru = file_name_dhru_buf; | ||
1794 | unsigned int i; | 1788 | unsigned int i; |
1795 | struct PendingReply *pending_rep = (struct PendingReply *) cls; | 1789 | struct PendingReply *pending_rep = (struct PendingReply *) cls; |
1796 | 1790 | ||
1797 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "profiler_reply_handle()\n"); | 1791 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "profiler_reply_handle()\n"); |
1798 | rps_peer = pending_rep->rps_peer; | 1792 | rps_peer = pending_rep->rps_peer; |
1799 | file_name = "/tmp/rps/received_ids"; | 1793 | (void) GNUNET_asprintf (&file_name, |
1800 | file_name_dh = "/tmp/rps/diehard_input"; | 1794 | "/tmp/rps/received_ids-%u", |
1801 | file_name_dhr = "/tmp/rps/diehard_input_raw"; | 1795 | rps_peer->index); |
1802 | file_name_dhru = "/tmp/rps/diehard_input_raw_aligned"; | 1796 | |
1797 | (void) GNUNET_asprintf (&file_name_dh, | ||
1798 | "/tmp/rps/diehard_input-%u", | ||
1799 | rps_peer->index); | ||
1800 | (void) GNUNET_asprintf (&file_name_dhr, | ||
1801 | "/tmp/rps/diehard_input_raw-%u", | ||
1802 | rps_peer->index); | ||
1803 | (void) GNUNET_asprintf (&file_name_dhru, | ||
1804 | "/tmp/rps/diehard_input_raw_aligned-%u", | ||
1805 | rps_peer->index); | ||
1803 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1806 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1804 | "[%s] got %" PRIu64 " peers:\n", | 1807 | "[%s] got %" PRIu64 " peers:\n", |
1805 | GNUNET_i2s (rps_peer->peer_id), | 1808 | GNUNET_i2s (rps_peer->peer_id), |
@@ -1855,7 +1858,7 @@ profiler_cb (struct RPSPeer *rps_peer) | |||
1855 | /* Only request peer ids at one peer. | 1858 | /* Only request peer ids at one peer. |
1856 | * (It's the before-last because last one is target of the focussed attack.) | 1859 | * (It's the before-last because last one is target of the focussed attack.) |
1857 | */ | 1860 | */ |
1858 | if (eval_peer == rps_peer) | 1861 | if (0 < rps_peer->num_ids_to_request) |
1859 | schedule_missing_requests (rps_peer); | 1862 | schedule_missing_requests (rps_peer); |
1860 | } | 1863 | } |
1861 | 1864 | ||
@@ -2727,10 +2730,6 @@ run (void *cls, | |||
2727 | if ( (2 == mal_type) || | 2730 | if ( (2 == mal_type) || |
2728 | (3 == mal_type)) | 2731 | (3 == mal_type)) |
2729 | target_peer = &rps_peer_ids[num_peers - 2]; | 2732 | target_peer = &rps_peer_ids[num_peers - 2]; |
2730 | if (profiler_eval == cur_test_run.eval_cb) | ||
2731 | eval_peer = &rps_peers[num_peers - 1]; /* FIXME: eval_peer could be a | ||
2732 | malicious peer if not careful | ||
2733 | with the malicious portion */ | ||
2734 | 2733 | ||
2735 | ok = 1; | 2734 | ok = 1; |
2736 | GNUNET_TESTBED_run (NULL, | 2735 | GNUNET_TESTBED_run (NULL, |