larger history, connect limit
authorNathan S. Evans <evans@in.tum.de>
Fri, 22 Jul 2011 12:47:54 +0000 (12:47 +0000)
committerNathan S. Evans <evans@in.tum.de>
Fri, 22 Jul 2011 12:47:54 +0000 (12:47 +0000)
src/nse/gnunet-service-nse.c
src/nse/nse-profiler.c

index 41b13a879f2b237f8dea2b43cf23ff0797e3d432..25d020caa2a6b05982b044d6bec3075d0d1bcd8e 100644 (file)
@@ -50,7 +50,7 @@
 #include "gnunet_nse_service.h"
 #include "nse.h"
 
-#define DEFAULT_HISTORY_SIZE 10
+#define DEFAULT_HISTORY_SIZE 20
 
 #define DEFAULT_CORE_QUEUE_SIZE 32
 
index 70ea1a68972b6db0242eec0c76eb7946669f82b2..a1e15fdcbea7407ec8e6720b0a4395c58b88b3e1 100644 (file)
@@ -31,6 +31,8 @@
 
 #define VERBOSE GNUNET_NO
 
+#define CONNECT_LIMIT GNUNET_YES
+
 struct NSEPeer
 {
   struct NSEPeer *prev;
@@ -135,6 +137,8 @@ static char *topology_file;
 
 static char *data_filename;
 
+static uint64_t clock_skew;
+
 /**
  * Check whether peers successfully shut down.
  */
@@ -225,6 +229,10 @@ connect_nse_service (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TEST_NSE_MULTIPEER: connecting to nse service of peers\n");
   for (i = 0; i < num_peers; i++)
     {
+#if CONNECT_LIMIT
+      if (i % 50 != 0)
+        continue;
+#endif
       current_peer = GNUNET_malloc(sizeof(struct NSEPeer));
       current_peer->daemon = GNUNET_TESTING_daemon_get(pg, i);
       if (GNUNET_YES == GNUNET_TESTING_daemon_running(GNUNET_TESTING_daemon_get(pg, i)))
@@ -323,14 +331,15 @@ disconnect_nse_peers (void *cls,
   pos = peer_head;
 
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TEST_NSE_MULTIPEER: disconnecting nse service of peers\n");
-  while (pos != NULL)
+  while (NULL != (pos = peer_head))
     {
       if (pos->nse_handle != NULL)
         {
           GNUNET_NSE_disconnect(pos->nse_handle);
           pos->nse_handle = NULL;
         }
-      pos = pos->next;
+      GNUNET_CONTAINER_DLL_remove(peer_head, peer_tail, pos);
+      GNUNET_free(pos);
     }
 
   GNUNET_asprintf(&buf, "round%llu", current_round);
@@ -552,6 +561,12 @@ run (void *cls,
       return;
     }
 
+  if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (testing_cfg, "nse-profiler", "skew_clock"))
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Setting our clock as skewed...\n");
+      clock_skew = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_TIME_UNIT_MINUTES.rel_value);
+    }
+
 
   data_file = GNUNET_DISK_file_open (data_filename, GNUNET_DISK_OPEN_READWRITE
                                                   | GNUNET_DISK_OPEN_CREATE,