gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35401 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r35401 - gnunet/src/rps
Date: Tue, 17 Mar 2015 14:45:03 +0100

Author: ch3
Date: 2015-03-17 14:45:03 +0100 (Tue, 17 Mar 2015)
New Revision: 35401

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
 -scheduling malicious do_round ()

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-03-17 13:05:58 UTC (rev 35400)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-03-17 13:45:03 UTC (rev 35401)
@@ -1400,6 +1400,10 @@
     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,8 +1412,25 @@
                                   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;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]