gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27729 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r27729 - gnunet/src/mesh
Date: Tue, 2 Jul 2013 21:38:13 +0200

Author: bartpolot
Date: 2013-07-02 21:38:13 +0200 (Tue, 02 Jul 2013)
New Revision: 27729

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
- add drop option for future testcases

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2013-07-02 18:21:57 UTC (rev 
27728)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2013-07-02 19:38:13 UTC (rev 
27729)
@@ -526,6 +526,10 @@
  */
 static unsigned long long max_peers;
 
+/**
+ * Percentage of messages that will be dropped (for test purposes only).
+ */
+static unsigned long long drop_percent;
 
 /*************************** Static global variables 
**************************/
 
@@ -2916,6 +2920,14 @@
       data_size = 0;
   }
 
+  if (0 < drop_percent &&
+      GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 101) < drop_percent)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Dropping message of type %s\n",
+                GNUNET_MESH_DEBUG_M2S(queue->type));
+    data_size = 0;
+  }
   /* Free queue, but cls was freed by send_core_* */
   queue_destroy (queue, GNUNET_NO);
 
@@ -5143,6 +5155,20 @@
   }
 
   if (GNUNET_OK !=
+    GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DROP_PERCENT",
+                                           &drop_percent))
+  {
+    drop_percent = 0;
+  }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Mesh is running with drop mode enabled. "
+                "This is NOT a good idea! "
+                "Remove the DROP_PERCENT option from your configuration.\n");
+  }
+
+  if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (c, "MESH", 
"DHT_REPLICATION_LEVEL",
                                              &dht_replication_level))
   {




reply via email to

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