From: Julius Bünger Date: Sat, 28 Mar 2015 15:28:54 +0000 (+0000) Subject: -fixes X-Git-Tag: initial-import-from-subversion-38251~2111 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4ebb81f479aaa9435e6c8927130c0617901b0cf5;p=oweals%2Fgnunet.git -fixes --- 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, } else if (0 == mal_type) { /* Stop acting malicious */ - num_mal_peers = 0; - if (NULL != mal_peers) - GNUNET_free (mal_peers); + GNUNET_array_grow (mal_peers, num_mal_peers, 0); /* Substitute do_mal_round () with do_round () */ GNUNET_SCHEDULER_cancel (do_round_task); @@ -1838,6 +1836,8 @@ handle_client_act_malicious (void *cls, { GNUNET_break (0); } + + GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -1983,9 +1983,9 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* Update gossip list */ - if ( push_list_size <= alpha * gossip_list_size && - push_list_size != 0 && - pull_list_size != 0 ) + if (push_list_size <= alpha * gossip_list_size + && push_list_size > 0 + && pull_list_size > 0) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the gossip list.\n"); 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, #ifdef ENABLE_MALICIOUS if (1 == mal_type - || 1 == mal_type) + || 2 == mal_type) { GNUNET_assert (1 >= portion && 0 < portion); @@ -318,9 +318,11 @@ rps_connect_complete_cb (void *cls, if (rps_peer->index >= num_mal_peers) { /* It's useless to ask a malicious peer about a random sample - it's not sampling */ - (void) GNUNET_RPS_request_peers (rps, 1, handle_reply, NULL); + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), + seed_peers, rps_peer); + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), + request_peers, rps_peer); } - return; } #endif /* ENABLE_MALICIOUS */ @@ -352,10 +354,10 @@ rps_connect_complete_cb (void *cls, } else if (SEED_REQUEST == test_type) { - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), - seed_peers, rps_peer); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15), - request_peers, rps_peer); + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), + seed_peers, rps_peer); + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15), + request_peers, rps_peer); } else if (REQUEST_CANCEL == test_type) { @@ -545,14 +547,14 @@ main (int argc, char *argv[]) unsigned int num_mal_peers; if (1 == mal_type) { - num_mal_peers = NUM_PEERS * portion; + num_mal_peers = round (NUM_PEERS * portion); ok = evaluate (&rps_peers[num_mal_peers], NUM_PEERS - (num_mal_peers), 1); } else if (2 == mal_type) { - num_mal_peers = NUM_PEERS * portion; + num_mal_peers = round (NUM_PEERS * portion); ok = evaluate (&rps_peers[num_mal_peers], NUM_PEERS - (num_mal_peers), 1);