-malicious peer type 1 sending pushes
authorJulius Bünger <buenger@mytum.de>
Wed, 25 Mar 2015 20:52:43 +0000 (20:52 +0000)
committerJulius Bünger <buenger@mytum.de>
Wed, 25 Mar 2015 20:52:43 +0000 (20:52 +0000)
src/rps/gnunet-service-rps.c

index 0270b3840b7702d24025768f18de48a6e6db6a0f..67e79daf73b9176968de6deacacd79794be3bb63 100644 (file)
@@ -397,8 +397,14 @@ struct AttackedPeer
 /**
  * If type is 2 this is the DLL of attacked peers
  */
-//static struct AttackedPeer *att_peers_head = NULL;
-//static struct AttackedPeer *att_peers_tail = NULL;
+static struct AttackedPeer *att_peers_head = NULL;
+static struct AttackedPeer *att_peers_tail = NULL;
+
+/**
+ * This index is used to point to an attacked peer to
+ * implement the round-robin-ish way to select attacked peers.
+ */
+static struct AttackedPeer *att_peer_index = NULL;
 
 /**
  * Number of attacked peers
@@ -1622,8 +1628,12 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     num_pushes = min (min (push_limit, /* FIXME: attacked peer */ num_mal_peers), GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE);
     for (i = 0 ; i < num_pushes ; i++)
     { /* Send PUSHes to attacked peers */
-      //GNUNET_CONTAINER_multihashmap_iterator_create
-      //send_push ();
+      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