}
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);
{
GNUNET_break (0);
}
+
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
/* 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");
#ifdef ENABLE_MALICIOUS
if (1 == mal_type
- || 1 == mal_type)
+ || 2 == mal_type)
{
GNUNET_assert (1 >= portion
&& 0 < portion);
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 */
}
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)
{
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);