gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26623 - gnunet/src/nse


From: gnunet
Subject: [GNUnet-SVN] r26623 - gnunet/src/nse
Date: Thu, 28 Mar 2013 10:09:12 +0100

Author: harsha
Date: 2013-03-28 10:09:12 +0100 (Thu, 28 Mar 2013)
New Revision: 26623

Modified:
   gnunet/src/nse/gnunet-nse-profiler.c
   gnunet/src/nse/gnunet-service-nse.c
Log:
- read unique peer-ids from testbed

Modified: gnunet/src/nse/gnunet-nse-profiler.c
===================================================================
--- gnunet/src/nse/gnunet-nse-profiler.c        2013-03-28 08:18:36 UTC (rev 
26622)
+++ gnunet/src/nse/gnunet-nse-profiler.c        2013-03-28 09:09:12 UTC (rev 
26623)
@@ -24,11 +24,11 @@
  *        Generally, the profiler starts a given number of peers,
  *        then churns some off, waits a certain amount of time, then
  *        churns again, and repeats.
- *
- * TODO:
- * - need to check for leaks (especially FD leaks)
- * - need to TEST
+ * @author Christian Grothoff
+ * @author Nathan Evans
+ * @author Sree Harsha Totakura
  */
+
 #include "platform.h"
 #include "gnunet_testbed_service.h"
 #include "gnunet_nse_service.h"
@@ -303,9 +303,16 @@
     GNUNET_TESTBED_operation_done (get_stats_op);
     get_stats_op = NULL;
   }
-  // FIXME: what about closing other files!?  
   if (NULL != data_file)
+  {
     GNUNET_DISK_file_close (data_file);
+    data_file = NULL;
+  }
+  if (NULL != output_file)
+  {
+    GNUNET_DISK_file_close (output_file);
+    output_file = NULL;
+  }
   if (NULL != testing_cfg)
     GNUNET_CONFIGURATION_destroy (testing_cfg);
   testing_cfg = NULL;

Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2013-03-28 08:18:36 UTC (rev 26622)
+++ gnunet/src/nse/gnunet-service-nse.c 2013-03-28 09:09:12 UTC (rev 26623)
@@ -1456,18 +1456,27 @@
   {
     char *hostname;
     char *hgram_file;
-
-    hostname = GNUNET_malloc (GNUNET_OS_get_hostname_max_length ());
-    if (0 == gethostname (hostname, HOST_NAME_MAX))
+    unsigned long long peer_id;
+    
+    hgram_file = NULL;
+    if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
+                                                            "PEERID", 
&peer_id))
+      (void) GNUNET_asprintf (&hgram_file, "%s/%llu.hist", proof, peer_id);
+    else  
     {
-      (void) GNUNET_asprintf (&hgram_file, "%s/%s_%jd.hist", 
-                              proof, hostname, (intmax_t) getpid());
+      hostname = GNUNET_malloc (GNUNET_OS_get_hostname_max_length ());
+      if (0 == gethostname (hostname, HOST_NAME_MAX))
+        (void) GNUNET_asprintf (&hgram_file, "%s/%s_%jd.hist", 
+                                proof, hostname, (intmax_t) getpid());
+      else
+        GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "gethostname");    
+      GNUNET_free (hostname);
+    }
+    if (NULL != hgram_file)
+    {
       wh = GNUNET_BIO_write_open (hgram_file);
       GNUNET_free (hgram_file);
     }
-    else
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "gethostname");    
-    GNUNET_free (hostname);
     GNUNET_free (proof);
   }
 #endif




reply via email to

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