aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorxrs <xrs@mail36.net>2018-06-25 16:53:01 +0200
committerxrs <xrs@mail36.net>2018-06-25 16:53:01 +0200
commitb96052f1d3b8bb05f1868bd809fcb6e4f6569a4c (patch)
treed70c5939cc99d43e29ce63a4faa9ef334de0c81d /src/rps
parent8405df1e1968b92d38e8bcebeee1471444410d97 (diff)
parent1c9e2fc460acce152ab6374b14b1e231ac455f57 (diff)
downloadgnunet-b96052f1d3b8bb05f1868bd809fcb6e4f6569a4c.tar.gz
gnunet-b96052f1d3b8bb05f1868bd809fcb6e4f6569a4c.zip
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-rps-profiler.c27
-rw-r--r--src/rps/gnunet-rps.c12
-rw-r--r--src/rps/rps-test_util.c5
-rw-r--r--src/rps/test_rps.conf23
4 files changed, 41 insertions, 26 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index a0e79e565..16f23e86c 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -1951,9 +1951,13 @@ static void compute_probabilities (uint32_t peer_idx)
1951 if ((GNUNET_YES == is_in_view (i, peer_idx)) && 1951 if ((GNUNET_YES == is_in_view (i, peer_idx)) &&
1952 (1 <= (0.45 * view_size))) 1952 (1 <= (0.45 * view_size)))
1953 { 1953 {
1954 prob_push = 1.0 * binom (0.45 * view_size, 1) 1954 if (0 == binom (view_size, 0.45 * view_size)) prob_push = 0;
1955 / 1955 else
1956 binom (view_size, 0.45 * view_size); 1956 {
1957 prob_push = 1.0 * binom (0.45 * view_size, 1)
1958 /
1959 binom (view_size, 0.45 * view_size);
1960 }
1957 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1961 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1958 "\t\t%" PRIu32 " is in %" PRIu32 "'s view, prob: %f\n", 1962 "\t\t%" PRIu32 " is in %" PRIu32 "'s view, prob: %f\n",
1959 peer_idx, 1963 peer_idx,
@@ -2318,6 +2322,7 @@ post_test_shutdown_ready_cb (void *cls,
2318 rps_peer->index); 2322 rps_peer->index);
2319 GNUNET_free (stat_cls); 2323 GNUNET_free (stat_cls);
2320 GNUNET_break (0); 2324 GNUNET_break (0);
2325 return;
2321 } 2326 }
2322 2327
2323 if (NULL != rps_peer->stat_op && 2328 if (NULL != rps_peer->stat_op &&
@@ -2494,7 +2499,6 @@ test_run (void *cls,
2494 struct OpListEntry *entry; 2499 struct OpListEntry *entry;
2495 2500
2496 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n"); 2501 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n");
2497 printf ("test 1\n");
2498 2502
2499 /* Check whether we timed out */ 2503 /* Check whether we timed out */
2500 if (n_peers != num_peers || 2504 if (n_peers != num_peers ||
@@ -2578,7 +2582,6 @@ test_run (void *cls,
2578 * 2582 *
2579 * @param argc unused 2583 * @param argc unused
2580 * @param argv unused 2584 * @param argv unused
2581 * @return 0 on success
2582 */ 2585 */
2583static void 2586static void
2584run (void *cls, 2587run (void *cls,
@@ -2635,12 +2638,12 @@ run (void *cls,
2635 } 2638 }
2636 2639
2637 /* Compute number of bits for representing largest peer id */ 2640 /* Compute number of bits for representing largest peer id */
2638 for (bits_needed = 1; (bits_needed << 1) < num_peers - 1; bits_needed++) 2641 for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++)
2639 ; 2642 ;
2640 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2643 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2641 "Need %u bits to represent largest peer id %" PRIu32 "\n", 2644 "Need %u bits to represent %" PRIu32 " peers\n",
2642 bits_needed, 2645 bits_needed,
2643 num_peers - 1); 2646 num_peers);
2644 2647
2645 rps_peers = GNUNET_new_array (num_peers, struct RPSPeer); 2648 rps_peers = GNUNET_new_array (num_peers, struct RPSPeer);
2646 peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO); 2649 peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO);
@@ -2654,8 +2657,6 @@ run (void *cls,
2654 with the malicious portion */ 2657 with the malicious portion */
2655 2658
2656 ok = 1; 2659 ok = 1;
2657 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2658 "before _run()\n");
2659 GNUNET_TESTBED_run (NULL, 2660 GNUNET_TESTBED_run (NULL,
2660 cfg, 2661 cfg,
2661 num_peers, 2662 num_peers,
@@ -2664,10 +2665,6 @@ run (void *cls,
2664 NULL, 2665 NULL,
2665 &test_run, 2666 &test_run,
2666 NULL); 2667 NULL);
2667 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2668 "after _run()\n");
2669 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2670 "gnunet-rps-profiler returned.\n");
2671} 2668}
2672 2669
2673/** 2670/**
@@ -2691,7 +2688,7 @@ main (int argc, char *argv[])
2691 GNUNET_GETOPT_option_relative_time ('t', 2688 GNUNET_GETOPT_option_relative_time ('t',
2692 "timeout", 2689 "timeout",
2693 "TIMEOUT", 2690 "TIMEOUT",
2694 gettext_noop ("timeout for DHT PUT and GET requests (default: 1 min)"), 2691 gettext_noop ("timeout for the profiling"),
2695 &timeout), 2692 &timeout),
2696 2693
2697 GNUNET_GETOPT_option_uint ('r', 2694 GNUNET_GETOPT_option_uint ('r',
diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c
index e09277589..739f71dac 100644
--- a/src/rps/gnunet-rps.c
+++ b/src/rps/gnunet-rps.c
@@ -155,7 +155,11 @@ run (void *cls,
155 (!view_update)) 155 (!view_update))
156 { /* Request n PeerIDs */ 156 { /* Request n PeerIDs */
157 /* If number was specified use it, else request single peer. */ 157 /* If number was specified use it, else request single peer. */
158 num_peers = (NULL == args[0]) ? 1 : atoi (args[0]); 158 if (NULL == args[0] ||
159 0 == sscanf (args[0], "%lu", &num_peers))
160 {
161 num_peers = 1;
162 }
159 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
160 "Requesting %" PRIu64 " PeerIDs\n", num_peers); 164 "Requesting %" PRIu64 " PeerIDs\n", num_peers);
161 req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, reply_handle, NULL); 165 req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, reply_handle, NULL);
@@ -163,7 +167,11 @@ run (void *cls,
163 } else if (view_update) 167 } else if (view_update)
164 { 168 {
165 /* Get updates of view */ 169 /* Get updates of view */
166 num_view_updates = (NULL == args[0]) ? 0 : atoi (args[0]); 170 if (NULL == args[0] ||
171 0 == sscanf (args[0], "%lu", &num_view_updates))
172 {
173 num_view_updates = 0;
174 }
167 GNUNET_RPS_view_request (rps_handle, num_view_updates, view_update_handle, NULL); 175 GNUNET_RPS_view_request (rps_handle, num_view_updates, view_update_handle, NULL);
168 if (0 != num_view_updates) 176 if (0 != num_view_updates)
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index 9a1dfe0d8..0ee290e67 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -155,6 +155,9 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf)
155 155
156 return; 156 return;
157 } 157 }
158 if (GNUNET_YES != GNUNET_DISK_file_close (f))
159 LOG (GNUNET_ERROR_TYPE_WARNING,
160 "Unable to close file\n");
158} 161}
159 162
160void 163void
@@ -384,7 +387,7 @@ store_prefix_file_name (const struct GNUNET_PeerIdentity *peer,
384 const char *prefix) 387 const char *prefix)
385{ 388{
386 unsigned int len_file_name; 389 unsigned int len_file_name;
387 unsigned int out_size; 390 int out_size;
388 char *file_name; 391 char *file_name;
389 const char *pid_long; 392 const char *pid_long;
390 393
diff --git a/src/rps/test_rps.conf b/src/rps/test_rps.conf
index 77a0df2c5..05bb9f444 100644
--- a/src/rps/test_rps.conf
+++ b/src/rps/test_rps.conf
@@ -21,17 +21,24 @@ FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt
21# So, 50 is enough for a network of size 50^3 = 125000 21# So, 50 is enough for a network of size 50^3 = 125000
22MINSIZE = 4 22MINSIZE = 4
23 23
24
25
24[testbed] 26[testbed]
25HOSTNAME = localhost 27HOSTNAME = localhost
26 28
27# OPERATION_TIMEOUT = 60 s
28
29# MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 100 29# MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 100
30OVERLAY_TOPOLOGY = CLIQUE
31#OVERLAY_TOPOLOGY = SMALL_WORLD
32#SCALE_FREE_TOPOLOGY_CAP =
33 30
34# OVERLAY_RANDOM_LINKS = 25 31#OVERLAY_TOPOLOGY = CLIQUE
32
33OVERLAY_TOPOLOGY = SCALE_FREE
34SCALE_FREE_TOPOLOGY_CAP = 100
35SCALE_FREE_TOPOLOGY_M = 2
36
37#OVERLAY_TOPOLOGY = RANDOM
38#OVERLAY_RANDOM_LINKS = 25
39
40#OVERLAY_TOPOLOGY = SMALL_WORLD
41#OVERLAY_RANDOM_LINKS = 25
35 42
36SETUP_TIMEOUT = 2 m 43SETUP_TIMEOUT = 2 m
37 44
@@ -41,12 +48,13 @@ WORKBITS = 0
41[nat] 48[nat]
42# Use addresses from the local network interfaces (inluding loopback, but also others) 49# Use addresses from the local network interfaces (inluding loopback, but also others)
43USE_LOCALADDR = YES 50USE_LOCALADDR = YES
51ENABLE_UPNP = NO
44 52
45# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8) 53# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
46RETURN_LOCAL_ADDRESSES = YES 54RETURN_LOCAL_ADDRESSES = YES
47 55
48[transport] 56[transport]
49PLUGINS = udp 57PLUGINS = unix
50 58
51[ats] 59[ats]
52# Network specific inbound/outbound quotas 60# Network specific inbound/outbound quotas
@@ -72,7 +80,6 @@ BLUETOOTH_QUOTA_OUT = unlimited
72DISABLE_TRY_CONNECT = YES 80DISABLE_TRY_CONNECT = YES
73 81
74[cadet] 82[cadet]
75DISABLE_TRY_CONNECT = YES
76#OPTIONS=-l /tmp/rps_profiler_logs/cadet-[]-%Y-%m-%d.log 83#OPTIONS=-l /tmp/rps_profiler_logs/cadet-[]-%Y-%m-%d.log
77#PREFIX = valgrind 84#PREFIX = valgrind
78 85