aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-03-28 15:28:54 +0000
committerJulius Bünger <buenger@mytum.de>2015-03-28 15:28:54 +0000
commit4ebb81f479aaa9435e6c8927130c0617901b0cf5 (patch)
treee6dcadd3a7966347cae50322f907907f327e312c /src
parent3a30016f3eb61c60156d7f53237e3690662c2dcc (diff)
downloadgnunet-4ebb81f479aaa9435e6c8927130c0617901b0cf5.tar.gz
gnunet-4ebb81f479aaa9435e6c8927130c0617901b0cf5.zip
-fixes
Diffstat (limited to 'src')
-rw-r--r--src/rps/gnunet-service-rps.c12
-rw-r--r--src/rps/test_rps.c20
2 files changed, 17 insertions, 15 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index b078dc405..1b09c70e2 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1826,9 +1826,7 @@ handle_client_act_malicious (void *cls,
1826 } 1826 }
1827 else if (0 == mal_type) 1827 else if (0 == mal_type)
1828 { /* Stop acting malicious */ 1828 { /* Stop acting malicious */
1829 num_mal_peers = 0; 1829 GNUNET_array_grow (mal_peers, num_mal_peers, 0);
1830 if (NULL != mal_peers)
1831 GNUNET_free (mal_peers);
1832 1830
1833 /* Substitute do_mal_round () with do_round () */ 1831 /* Substitute do_mal_round () with do_round () */
1834 GNUNET_SCHEDULER_cancel (do_round_task); 1832 GNUNET_SCHEDULER_cancel (do_round_task);
@@ -1838,6 +1836,8 @@ handle_client_act_malicious (void *cls,
1838 { 1836 {
1839 GNUNET_break (0); 1837 GNUNET_break (0);
1840 } 1838 }
1839
1840 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1841} 1841}
1842 1842
1843 1843
@@ -1983,9 +1983,9 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1983 1983
1984 /* Update gossip list */ 1984 /* Update gossip list */
1985 1985
1986 if ( push_list_size <= alpha * gossip_list_size && 1986 if (push_list_size <= alpha * gossip_list_size
1987 push_list_size != 0 && 1987 && push_list_size > 0
1988 pull_list_size != 0 ) 1988 && pull_list_size > 0)
1989 { 1989 {
1990 LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the gossip list.\n"); 1990 LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the gossip list.\n");
1991 1991
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 06df22583..52684bfde 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -309,7 +309,7 @@ rps_connect_complete_cb (void *cls,
309 309
310 #ifdef ENABLE_MALICIOUS 310 #ifdef ENABLE_MALICIOUS
311 if (1 == mal_type 311 if (1 == mal_type
312 || 1 == mal_type) 312 || 2 == mal_type)
313 { 313 {
314 GNUNET_assert (1 >= portion 314 GNUNET_assert (1 >= portion
315 && 0 < portion); 315 && 0 < portion);
@@ -318,9 +318,11 @@ rps_connect_complete_cb (void *cls,
318 if (rps_peer->index >= num_mal_peers) 318 if (rps_peer->index >= num_mal_peers)
319 { /* It's useless to ask a malicious peer about a random sample - 319 { /* It's useless to ask a malicious peer about a random sample -
320 it's not sampling */ 320 it's not sampling */
321 (void) GNUNET_RPS_request_peers (rps, 1, handle_reply, NULL); 321 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2),
322 seed_peers, rps_peer);
323 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
324 request_peers, rps_peer);
322 } 325 }
323 return;
324 } 326 }
325 #endif /* ENABLE_MALICIOUS */ 327 #endif /* ENABLE_MALICIOUS */
326 328
@@ -352,10 +354,10 @@ rps_connect_complete_cb (void *cls,
352 } 354 }
353 else if (SEED_REQUEST == test_type) 355 else if (SEED_REQUEST == test_type)
354 { 356 {
355 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), 357 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2),
356 seed_peers, rps_peer); 358 seed_peers, rps_peer);
357 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15), 359 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15),
358 request_peers, rps_peer); 360 request_peers, rps_peer);
359 } 361 }
360 else if (REQUEST_CANCEL == test_type) 362 else if (REQUEST_CANCEL == test_type)
361 { 363 {
@@ -545,14 +547,14 @@ main (int argc, char *argv[])
545 unsigned int num_mal_peers; 547 unsigned int num_mal_peers;
546 if (1 == mal_type) 548 if (1 == mal_type)
547 { 549 {
548 num_mal_peers = NUM_PEERS * portion; 550 num_mal_peers = round (NUM_PEERS * portion);
549 ok = evaluate (&rps_peers[num_mal_peers], 551 ok = evaluate (&rps_peers[num_mal_peers],
550 NUM_PEERS - (num_mal_peers), 552 NUM_PEERS - (num_mal_peers),
551 1); 553 1);
552 } 554 }
553 else if (2 == mal_type) 555 else if (2 == mal_type)
554 { 556 {
555 num_mal_peers = NUM_PEERS * portion; 557 num_mal_peers = round (NUM_PEERS * portion);
556 ok = evaluate (&rps_peers[num_mal_peers], 558 ok = evaluate (&rps_peers[num_mal_peers],
557 NUM_PEERS - (num_mal_peers), 559 NUM_PEERS - (num_mal_peers),
558 1); 560 1);