gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35456 - gnunet/src/rps
Date: Wed, 25 Mar 2015 22:08:11 +0100

Author: ch3
Date: 2015-03-25 22:08:11 +0100 (Wed, 25 Mar 2015)
New Revision: 35456

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
-mal peer type 1 pulls

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-03-25 20:52:43 UTC (rev 35455)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-03-25 21:08:11 UTC (rev 35456)
@@ -409,7 +409,7 @@
 /**
  * Number of attacked peers
  */
-//static uint32_t num_attacked_peers = 0;
+static uint32_t num_attacked_peers = 0;
 
 
 /**
@@ -1619,25 +1619,40 @@
   uint32_t num_pushes;
   uint32_t i;
   struct GNUNET_TIME_Relative time_next_round;
+  struct AttackedPeer *tmp_att_peer;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously.\n");
 
   /* Do malicious actions */
   if (1 == mal_type)
   { /* Try to maximise representation */
-    num_pushes = min (min (push_limit, /* FIXME: attacked peer */ 
num_mal_peers), GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE);
+    num_pushes = min (min (push_limit,
+                           num_attacked_peers),
+                       GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE);
+
+    /* Send PUSHes to attacked peers */
     for (i = 0 ; i < num_pushes ; i++)
-    { /* Send PUSHes to attacked peers */
+    {
       if (att_peers_tail == att_peer_index)
         att_peer_index = att_peers_head;
       else
         att_peer_index = att_peer_index->next;
 
       send_push (att_peer_index->peer_id);
+    }
 
-      // TODO send pulls
-      // send_pull_request
+    /* Send PULLs to some peers to learn about additional peers to attack */
+    tmp_att_peer = att_peer_index;
+    for (i = 0 ; i < num_pushes * alpha ; i++)
+    {
+      if (att_peers_tail == tmp_att_peer)
+        tmp_att_peer = att_peers_head;
+      else
+        att_peer_index = tmp_att_peer->next;
+
+      send_pull_request (tmp_att_peer->peer_id);
     }
+
   }
   else if (2 == mal_type)
   { /**




reply via email to

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