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/nse/gnunet-service-nse.c | |
parent | 37d441c8117448ffdb22bd637f5a96108c593fe6 (diff) | |
download | gnunet-91a19e42a46f01653d6695e115554719f2ad02d0.tar.gz gnunet-91a19e42a46f01653d6695e115554719f2ad02d0.zip |
- read unique peer-ids from testbed
Diffstat (limited to 'src/nse/gnunet-service-nse.c')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 25 |
1 files changed, 17 insertions, 8 deletions
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 |