diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-28 09:09:12 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-28 09:09:12 +0000 |
commit | 91a19e42a46f01653d6695e115554719f2ad02d0 (patch) | |
tree | 8ee6e2396caae41b390c056a4765ddc4518ef7f9 /src | |
parent | 37d441c8117448ffdb22bd637f5a96108c593fe6 (diff) | |
download | gnunet-91a19e42a46f01653d6695e115554719f2ad02d0.tar.gz gnunet-91a19e42a46f01653d6695e115554719f2ad02d0.zip |
- read unique peer-ids from testbed
Diffstat (limited to 'src')
-rw-r--r-- | src/nse/gnunet-nse-profiler.c | 17 | ||||
-rw-r--r-- | src/nse/gnunet-service-nse.c | 25 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index 7fe803673..9ed998c84 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -24,11 +24,11 @@ | |||
24 | * Generally, the profiler starts a given number of peers, | 24 | * Generally, the profiler starts a given number of peers, |
25 | * then churns some off, waits a certain amount of time, then | 25 | * then churns some off, waits a certain amount of time, then |
26 | * churns again, and repeats. | 26 | * churns again, and repeats. |
27 | * | 27 | * @author Christian Grothoff |
28 | * TODO: | 28 | * @author Nathan Evans |
29 | * - need to check for leaks (especially FD leaks) | 29 | * @author Sree Harsha Totakura |
30 | * - need to TEST | ||
31 | */ | 30 | */ |
31 | |||
32 | #include "platform.h" | 32 | #include "platform.h" |
33 | #include "gnunet_testbed_service.h" | 33 | #include "gnunet_testbed_service.h" |
34 | #include "gnunet_nse_service.h" | 34 | #include "gnunet_nse_service.h" |
@@ -303,9 +303,16 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
303 | GNUNET_TESTBED_operation_done (get_stats_op); | 303 | GNUNET_TESTBED_operation_done (get_stats_op); |
304 | get_stats_op = NULL; | 304 | get_stats_op = NULL; |
305 | } | 305 | } |
306 | // FIXME: what about closing other files!? | ||
307 | if (NULL != data_file) | 306 | if (NULL != data_file) |
307 | { | ||
308 | GNUNET_DISK_file_close (data_file); | 308 | GNUNET_DISK_file_close (data_file); |
309 | data_file = NULL; | ||
310 | } | ||
311 | if (NULL != output_file) | ||
312 | { | ||
313 | GNUNET_DISK_file_close (output_file); | ||
314 | output_file = NULL; | ||
315 | } | ||
309 | if (NULL != testing_cfg) | 316 | if (NULL != testing_cfg) |
310 | GNUNET_CONFIGURATION_destroy (testing_cfg); | 317 | GNUNET_CONFIGURATION_destroy (testing_cfg); |
311 | testing_cfg = NULL; | 318 | testing_cfg = NULL; |
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index aa90572fd..2b7b3f8ee 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -1456,18 +1456,27 @@ key_generation_cb (void *cls, | |||
1456 | { | 1456 | { |
1457 | char *hostname; | 1457 | char *hostname; |
1458 | char *hgram_file; | 1458 | char *hgram_file; |
1459 | 1459 | unsigned long long peer_id; | |
1460 | hostname = GNUNET_malloc (GNUNET_OS_get_hostname_max_length ()); | 1460 | |
1461 | if (0 == gethostname (hostname, HOST_NAME_MAX)) | 1461 | hgram_file = NULL; |
1462 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED", | ||
1463 | "PEERID", &peer_id)) | ||
1464 | (void) GNUNET_asprintf (&hgram_file, "%s/%llu.hist", proof, peer_id); | ||
1465 | else | ||
1466 | { | ||
1467 | hostname = GNUNET_malloc (GNUNET_OS_get_hostname_max_length ()); | ||
1468 | if (0 == gethostname (hostname, HOST_NAME_MAX)) | ||
1469 | (void) GNUNET_asprintf (&hgram_file, "%s/%s_%jd.hist", | ||
1470 | proof, hostname, (intmax_t) getpid()); | ||
1471 | else | ||
1472 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "gethostname"); | ||
1473 | GNUNET_free (hostname); | ||
1474 | } | ||
1475 | if (NULL != hgram_file) | ||
1462 | { | 1476 | { |
1463 | (void) GNUNET_asprintf (&hgram_file, "%s/%s_%jd.hist", | ||
1464 | proof, hostname, (intmax_t) getpid()); | ||
1465 | wh = GNUNET_BIO_write_open (hgram_file); | 1477 | wh = GNUNET_BIO_write_open (hgram_file); |
1466 | GNUNET_free (hgram_file); | 1478 | GNUNET_free (hgram_file); |
1467 | } | 1479 | } |
1468 | else | ||
1469 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "gethostname"); | ||
1470 | GNUNET_free (hostname); | ||
1471 | GNUNET_free (proof); | 1480 | GNUNET_free (proof); |
1472 | } | 1481 | } |
1473 | #endif | 1482 | #endif |