aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-03-17 13:45:03 +0000
committerJulius Bünger <buenger@mytum.de>2015-03-17 13:45:03 +0000
commit0e64a7ef1e82bba33eda71bf4a6cc2059b31e1ec (patch)
treebec2e9cdad6c55fef34b2e57681daf36c376e544
parentc99b7b016fc341be3d90234aaa4d785376a9116d (diff)
-scheduling malicious do_round ()
-rw-r--r--src/rps/gnunet-service-rps.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 455da399cd..3148997aa6 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1400,6 +1400,10 @@ handle_peer_act_malicious (void *cls,
mal_peers = GNUNET_new_array (num_mal_peers,
struct GNUNET_PeerIdentity);
memcpy (mal_peers, peers, num_mal_peers);
+
+ /* Substitute do_round () with do_mal_round () */
+ GNUNET_SCHEDULER_cancel (do_round_task);
+ do_round_task = GNUNET_SCHEDULER_add_now (&do_mal_round, NULL);
}
else if (2 == mal_type)
{ /* Try to partition the network */
@@ -1408,6 +1412,23 @@ handle_peer_act_malicious (void *cls,
struct GNUNET_PeerIdentity);
memcpy (mal_peers, peers, num_mal_peers);
attacked_peer = peers[num_mal_peers];
+
+ /* Substitute do_round () with do_mal_round () */
+ GNUNET_SCHEDULER_cancel (do_round_task);
+ do_round_task = GNUNET_SCHEDULER_add_now (&do_mal_round, NULL);
+ }
+ else if (0 == mal_type)
+ { /* Stop acting malicious */
+ num_mal_peers = 0;
+ GNUNET_free (mal_peers);
+
+ /* Substitute do_mal_round () with do_round () */
+ GNUNET_SCHEDULER_cancel (do_round_task);
+ do_round_task = GNUNET_SCHEDULER_add_now (&do_round, NULL);
+ }
+ else
+ {
+ GNUNET_break (0);
}
return GNUNET_OK;