diff options
author | Julius Bünger <buenger@mytum.de> | 2015-03-17 13:45:03 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-03-17 13:45:03 +0000 |
commit | 0e64a7ef1e82bba33eda71bf4a6cc2059b31e1ec (patch) | |
tree | bec2e9cdad6c55fef34b2e57681daf36c376e544 /src/rps | |
parent | c99b7b016fc341be3d90234aaa4d785376a9116d (diff) | |
download | gnunet-0e64a7ef1e82bba33eda71bf4a6cc2059b31e1ec.tar.gz gnunet-0e64a7ef1e82bba33eda71bf4a6cc2059b31e1ec.zip |
-scheduling malicious do_round ()
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 455da399c..3148997aa 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, | |||
1400 | mal_peers = GNUNET_new_array (num_mal_peers, | 1400 | mal_peers = GNUNET_new_array (num_mal_peers, |
1401 | struct GNUNET_PeerIdentity); | 1401 | struct GNUNET_PeerIdentity); |
1402 | memcpy (mal_peers, peers, num_mal_peers); | 1402 | memcpy (mal_peers, peers, num_mal_peers); |
1403 | |||
1404 | /* Substitute do_round () with do_mal_round () */ | ||
1405 | GNUNET_SCHEDULER_cancel (do_round_task); | ||
1406 | do_round_task = GNUNET_SCHEDULER_add_now (&do_mal_round, NULL); | ||
1403 | } | 1407 | } |
1404 | else if (2 == mal_type) | 1408 | else if (2 == mal_type) |
1405 | { /* Try to partition the network */ | 1409 | { /* Try to partition the network */ |
@@ -1408,6 +1412,23 @@ handle_peer_act_malicious (void *cls, | |||
1408 | struct GNUNET_PeerIdentity); | 1412 | struct GNUNET_PeerIdentity); |
1409 | memcpy (mal_peers, peers, num_mal_peers); | 1413 | memcpy (mal_peers, peers, num_mal_peers); |
1410 | attacked_peer = peers[num_mal_peers]; | 1414 | attacked_peer = peers[num_mal_peers]; |
1415 | |||
1416 | /* Substitute do_round () with do_mal_round () */ | ||
1417 | GNUNET_SCHEDULER_cancel (do_round_task); | ||
1418 | do_round_task = GNUNET_SCHEDULER_add_now (&do_mal_round, NULL); | ||
1419 | } | ||
1420 | else if (0 == mal_type) | ||
1421 | { /* Stop acting malicious */ | ||
1422 | num_mal_peers = 0; | ||
1423 | GNUNET_free (mal_peers); | ||
1424 | |||
1425 | /* Substitute do_mal_round () with do_round () */ | ||
1426 | GNUNET_SCHEDULER_cancel (do_round_task); | ||
1427 | do_round_task = GNUNET_SCHEDULER_add_now (&do_round, NULL); | ||
1428 | } | ||
1429 | else | ||
1430 | { | ||
1431 | GNUNET_break (0); | ||
1411 | } | 1432 | } |
1412 | 1433 | ||
1413 | return GNUNET_OK; | 1434 | return GNUNET_OK; |