gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35481 - gnunet/src/rps
Date: Sat, 28 Mar 2015 16:28:54 +0100

Author: ch3
Date: 2015-03-28 16:28:54 +0100 (Sat, 28 Mar 2015)
New Revision: 35481

Modified:
   gnunet/src/rps/gnunet-service-rps.c
   gnunet/src/rps/test_rps.c
Log:
-fixes

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-03-28 15:28:50 UTC (rev 35480)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-03-28 15:28:54 UTC (rev 35481)
@@ -1826,9 +1826,7 @@
   }
   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 @@
   {
     GNUNET_break (0);
   }
+
+  GNUNET_SERVER_receive_done (client,  GNUNET_OK);
 }
 
 
@@ -1983,9 +1983,9 @@
 
   /* 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");
 

Modified: gnunet/src/rps/test_rps.c
===================================================================
--- gnunet/src/rps/test_rps.c   2015-03-28 15:28:50 UTC (rev 35480)
+++ gnunet/src/rps/test_rps.c   2015-03-28 15:28:54 UTC (rev 35481)
@@ -309,7 +309,7 @@
 
   #ifdef ENABLE_MALICIOUS
   if (1 == mal_type
-      || 1 == mal_type)
+      || 2 == mal_type)
   {
     GNUNET_assert (1 >= portion
                    && 0 <  portion);
@@ -318,9 +318,11 @@
     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 @@
   }
   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 @@
   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);




reply via email to

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