diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-09-17 10:45:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-09-17 10:45:23 +0000 |
commit | 7e065c18499688141eb68513058131a49344cac1 (patch) | |
tree | e441b44c8f0db8a4f214775e4945039cc820cf2f /src/nse | |
parent | b3ad920b6e0107c3da946fe1f2f720955dbac151 (diff) | |
download | gnunet-7e065c18499688141eb68513058131a49344cac1.tar.gz gnunet-7e065c18499688141eb68513058131a49344cac1.zip |
Diffstat (limited to 'src/nse')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 195 |
1 files changed, 115 insertions, 80 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 3031e6853..435f22774 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -304,6 +304,16 @@ static struct GNUNET_PeerIdentity my_identity; | |||
304 | */ | 304 | */ |
305 | static uint64_t my_proof; | 305 | static uint64_t my_proof; |
306 | 306 | ||
307 | /** | ||
308 | * Handle to this serivce's server. | ||
309 | */ | ||
310 | static struct GNUNET_SERVER_Handle *srv; | ||
311 | |||
312 | /** | ||
313 | * Hostkey generation context | ||
314 | */ | ||
315 | static struct GNUNET_CRYPTO_RsaKeyGenerationContext *keygen; | ||
316 | |||
307 | 317 | ||
308 | /** | 318 | /** |
309 | * Initialize a message to clients with the current network | 319 | * Initialize a message to clients with the current network |
@@ -576,7 +586,7 @@ transmit_ready (void *cls, size_t size, void *buf) | |||
576 | GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task_cb, | 586 | GNUNET_SCHEDULER_add_delayed (get_transmit_delay (0), &transmit_task_cb, |
577 | peer_entry); | 587 | peer_entry); |
578 | } | 588 | } |
579 | if ((ntohl (size_estimate_messages[idx].hop_count) == 0) && | 589 | if ((0 == ntohl (size_estimate_messages[idx].hop_count)) && |
580 | (GNUNET_SCHEDULER_NO_TASK != proof_task)) | 590 | (GNUNET_SCHEDULER_NO_TASK != proof_task)) |
581 | { | 591 | { |
582 | GNUNET_STATISTICS_update (stats, | 592 | GNUNET_STATISTICS_update (stats, |
@@ -584,7 +594,7 @@ transmit_ready (void *cls, size_t size, void *buf) | |||
584 | 1, GNUNET_NO); | 594 | 1, GNUNET_NO); |
585 | return 0; | 595 | return 0; |
586 | } | 596 | } |
587 | if (ntohs (size_estimate_messages[idx].header.size) == 0) | 597 | if (0 == ntohs (size_estimate_messages[idx].header.size)) |
588 | { | 598 | { |
589 | GNUNET_STATISTICS_update (stats, | 599 | GNUNET_STATISTICS_update (stats, |
590 | "# flood messages not generated (lack of history)", | 600 | "# flood messages not generated (lack of history)", |
@@ -661,7 +671,8 @@ update_network_size_estimate () | |||
661 | * @param ts timestamp to use | 671 | * @param ts timestamp to use |
662 | */ | 672 | */ |
663 | static void | 673 | static void |
664 | setup_flood_message (unsigned int slot, struct GNUNET_TIME_Absolute ts) | 674 | setup_flood_message (unsigned int slot, |
675 | struct GNUNET_TIME_Absolute ts) | ||
665 | { | 676 | { |
666 | struct GNUNET_NSE_FloodMessage *fm; | 677 | struct GNUNET_NSE_FloodMessage *fm; |
667 | uint32_t matching_bits; | 678 | uint32_t matching_bits; |
@@ -699,7 +710,9 @@ setup_flood_message (unsigned int slot, struct GNUNET_TIME_Absolute ts) | |||
699 | * @return GNUNET_OK (continue to iterate) | 710 | * @return GNUNET_OK (continue to iterate) |
700 | */ | 711 | */ |
701 | static int | 712 | static int |
702 | schedule_current_round (void *cls, const struct GNUNET_HashCode * key, void *value) | 713 | schedule_current_round (void *cls, |
714 | const struct GNUNET_HashCode * key, | ||
715 | void *value) | ||
703 | { | 716 | { |
704 | struct NSEPeerEntry *peer_entry = value; | 717 | struct NSEPeerEntry *peer_entry = value; |
705 | struct GNUNET_TIME_Relative delay; | 718 | struct GNUNET_TIME_Relative delay; |
@@ -958,7 +971,7 @@ update_flood_times (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
958 | struct NSEPeerEntry *peer_entry = value; | 971 | struct NSEPeerEntry *peer_entry = value; |
959 | struct GNUNET_TIME_Relative delay; | 972 | struct GNUNET_TIME_Relative delay; |
960 | 973 | ||
961 | if (peer_entry->th != NULL) | 974 | if (NULL != peer_entry->th) |
962 | return GNUNET_OK; /* already active */ | 975 | return GNUNET_OK; /* already active */ |
963 | if (peer_entry == exclude) | 976 | if (peer_entry == exclude) |
964 | return GNUNET_OK; /* trigger of the update */ | 977 | return GNUNET_OK; /* trigger of the update */ |
@@ -966,14 +979,14 @@ update_flood_times (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
966 | { | 979 | { |
967 | /* still stuck in previous round, no point to update, check that | 980 | /* still stuck in previous round, no point to update, check that |
968 | * we are active here though... */ | 981 | * we are active here though... */ |
969 | if (GNUNET_SCHEDULER_NO_TASK == peer_entry->transmit_task && | 982 | if ( (GNUNET_SCHEDULER_NO_TASK == peer_entry->transmit_task) && |
970 | NULL == peer_entry->th) | 983 | (NULL == peer_entry->th) ) |
971 | { | 984 | { |
972 | GNUNET_break (0); | 985 | GNUNET_break (0); |
973 | } | 986 | } |
974 | return GNUNET_OK; | 987 | return GNUNET_OK; |
975 | } | 988 | } |
976 | if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) | 989 | if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task) |
977 | { | 990 | { |
978 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); | 991 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); |
979 | peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; | 992 | peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -1099,7 +1112,7 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1099 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); | 1112 | GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); |
1100 | peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; | 1113 | peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; |
1101 | } | 1114 | } |
1102 | if (peer_entry->th != NULL) | 1115 | if (NULL != peer_entry->th) |
1103 | { | 1116 | { |
1104 | GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th); | 1117 | GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th); |
1105 | peer_entry->th = NULL; | 1118 | peer_entry->th = NULL; |
@@ -1228,7 +1241,7 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1228 | GNUNET_SCHEDULER_cancel (pos->transmit_task); | 1241 | GNUNET_SCHEDULER_cancel (pos->transmit_task); |
1229 | pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; | 1242 | pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; |
1230 | } | 1243 | } |
1231 | if (pos->th != NULL) | 1244 | if (NULL != pos->th) |
1232 | { | 1245 | { |
1233 | GNUNET_CORE_notify_transmit_ready_cancel (pos->th); | 1246 | GNUNET_CORE_notify_transmit_ready_cancel (pos->th); |
1234 | pos->th = NULL; | 1247 | pos->th = NULL; |
@@ -1247,44 +1260,49 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1247 | static void | 1260 | static void |
1248 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1261 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1249 | { | 1262 | { |
1250 | if (flood_task != GNUNET_SCHEDULER_NO_TASK) | 1263 | if (GNUNET_SCHEDULER_NO_TASK != flood_task) |
1251 | { | 1264 | { |
1252 | GNUNET_SCHEDULER_cancel (flood_task); | 1265 | GNUNET_SCHEDULER_cancel (flood_task); |
1253 | flood_task = GNUNET_SCHEDULER_NO_TASK; | 1266 | flood_task = GNUNET_SCHEDULER_NO_TASK; |
1254 | } | 1267 | } |
1255 | if (proof_task != GNUNET_SCHEDULER_NO_TASK) | 1268 | if (GNUNET_SCHEDULER_NO_TASK != proof_task) |
1256 | { | 1269 | { |
1257 | GNUNET_SCHEDULER_cancel (proof_task); | 1270 | GNUNET_SCHEDULER_cancel (proof_task); |
1258 | proof_task = GNUNET_SCHEDULER_NO_TASK; | 1271 | proof_task = GNUNET_SCHEDULER_NO_TASK; |
1259 | write_proof (); /* remember progress */ | 1272 | write_proof (); /* remember progress */ |
1260 | } | 1273 | } |
1261 | if (nc != NULL) | 1274 | if (NULL != keygen) |
1275 | { | ||
1276 | GNUNET_CRYPTO_rsa_key_create_stop (keygen); | ||
1277 | keygen = NULL; | ||
1278 | } | ||
1279 | if (NULL != nc) | ||
1262 | { | 1280 | { |
1263 | GNUNET_SERVER_notification_context_destroy (nc); | 1281 | GNUNET_SERVER_notification_context_destroy (nc); |
1264 | nc = NULL; | 1282 | nc = NULL; |
1265 | } | 1283 | } |
1266 | if (coreAPI != NULL) | 1284 | if (NULL != coreAPI) |
1267 | { | 1285 | { |
1268 | GNUNET_CORE_disconnect (coreAPI); | 1286 | GNUNET_CORE_disconnect (coreAPI); |
1269 | coreAPI = NULL; | 1287 | coreAPI = NULL; |
1270 | } | 1288 | } |
1271 | if (stats != NULL) | 1289 | if (NULL != stats) |
1272 | { | 1290 | { |
1273 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | 1291 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
1274 | stats = NULL; | 1292 | stats = NULL; |
1275 | } | 1293 | } |
1276 | if (peers != NULL) | 1294 | if (NULL != peers) |
1277 | { | 1295 | { |
1278 | GNUNET_CONTAINER_multihashmap_destroy (peers); | 1296 | GNUNET_CONTAINER_multihashmap_destroy (peers); |
1279 | peers = NULL; | 1297 | peers = NULL; |
1280 | } | 1298 | } |
1281 | if (my_private_key != NULL) | 1299 | if (NULL != my_private_key) |
1282 | { | 1300 | { |
1283 | GNUNET_CRYPTO_rsa_key_free (my_private_key); | 1301 | GNUNET_CRYPTO_rsa_key_free (my_private_key); |
1284 | my_private_key = NULL; | 1302 | my_private_key = NULL; |
1285 | } | 1303 | } |
1286 | #if ENABLE_HISTOGRAM | 1304 | #if ENABLE_HISTOGRAM |
1287 | if (wh != NULL) | 1305 | if (NULL != wh) |
1288 | { | 1306 | { |
1289 | GNUNET_break (GNUNET_OK == GNUNET_BIO_write_close (wh)); | 1307 | GNUNET_break (GNUNET_OK == GNUNET_BIO_write_close (wh)); |
1290 | wh = NULL; | 1308 | wh = NULL; |
@@ -1341,19 +1359,17 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
1341 | 1359 | ||
1342 | 1360 | ||
1343 | /** | 1361 | /** |
1344 | * Handle network size estimate clients. | 1362 | * Callback for hostkey read/generation |
1345 | * | 1363 | * |
1346 | * @param cls closure | 1364 | * @param cls NULL |
1347 | * @param server the initialized server | 1365 | * @param pk the private key |
1348 | * @param c configuration to use | 1366 | * @param emsg error message |
1349 | */ | 1367 | */ |
1350 | static void | 1368 | static void |
1351 | run (void *cls, struct GNUNET_SERVER_Handle *server, | 1369 | key_generation_cb (void *cls, |
1352 | const struct GNUNET_CONFIGURATION_Handle *c) | 1370 | struct GNUNET_CRYPTO_RsaPrivateKey *pk, |
1371 | const char *emsg) | ||
1353 | { | 1372 | { |
1354 | char *keyfile; | ||
1355 | char *proof; | ||
1356 | |||
1357 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 1373 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
1358 | {&handle_start_message, NULL, GNUNET_MESSAGE_TYPE_NSE_START, | 1374 | {&handle_start_message, NULL, GNUNET_MESSAGE_TYPE_NSE_START, |
1359 | sizeof (struct GNUNET_MessageHeader)}, | 1375 | sizeof (struct GNUNET_MessageHeader)}, |
@@ -1364,52 +1380,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1364 | sizeof (struct GNUNET_NSE_FloodMessage)}, | 1380 | sizeof (struct GNUNET_NSE_FloodMessage)}, |
1365 | {NULL, 0, 0} | 1381 | {NULL, 0, 0} |
1366 | }; | 1382 | }; |
1367 | cfg = c; | 1383 | char *proof; |
1368 | |||
1369 | if ((GNUNET_OK != | ||
1370 | GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "INTERVAL", | ||
1371 | &gnunet_nse_interval)) || | ||
1372 | (GNUNET_OK != | ||
1373 | GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "WORKDELAY", | ||
1374 | &proof_find_delay)) || | ||
1375 | (GNUNET_OK != | ||
1376 | GNUNET_CONFIGURATION_get_value_number (cfg, "NSE", "WORKBITS", | ||
1377 | &nse_work_required))) | ||
1378 | { | ||
1379 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1380 | _ | ||
1381 | ("NSE service is lacking key configuration settings. Exiting.\n")); | ||
1382 | GNUNET_SCHEDULER_shutdown (); | ||
1383 | return; | ||
1384 | } | ||
1385 | if (nse_work_required >= sizeof (struct GNUNET_HashCode) * 8) | ||
1386 | { | ||
1387 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1388 | _("Invalid work requirement for NSE service. Exiting.\n")); | ||
1389 | GNUNET_SCHEDULER_shutdown (); | ||
1390 | return; | ||
1391 | } | ||
1392 | |||
1393 | 1384 | ||
1394 | if (GNUNET_OK != | 1385 | keygen = NULL; |
1395 | GNUNET_CONFIGURATION_get_value_filename (cfg, "GNUNETD", "HOSTKEY", | 1386 | if (NULL == pk) |
1396 | &keyfile)) | ||
1397 | { | ||
1398 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1399 | _ | ||
1400 | ("NSE service is lacking key configuration settings. Exiting.\n")); | ||
1401 | GNUNET_SCHEDULER_shutdown (); | ||
1402 | return; | ||
1403 | } | ||
1404 | my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | ||
1405 | GNUNET_free (keyfile); | ||
1406 | if (my_private_key == NULL) | ||
1407 | { | 1387 | { |
1408 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1388 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1409 | _("NSE service could not access hostkey. Exiting.\n")); | 1389 | _("NSE service could not access hostkey: %s\n"), |
1390 | emsg); | ||
1410 | GNUNET_SCHEDULER_shutdown (); | 1391 | GNUNET_SCHEDULER_shutdown (); |
1411 | return; | 1392 | return; |
1412 | } | 1393 | } |
1394 | my_private_key = pk; | ||
1413 | GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &my_public_key); | 1395 | GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &my_public_key); |
1414 | GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), | 1396 | GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), |
1415 | &my_identity.hashPubKey); | 1397 | &my_identity.hashPubKey); |
@@ -1419,11 +1401,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1419 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1401 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1420 | _ | 1402 | _ |
1421 | ("NSE service is lacking key configuration settings. Exiting.\n")); | 1403 | ("NSE service is lacking key configuration settings. Exiting.\n")); |
1422 | if (my_private_key != NULL) | 1404 | GNUNET_CRYPTO_rsa_key_free (my_private_key); |
1423 | { | 1405 | my_private_key = NULL; |
1424 | GNUNET_CRYPTO_rsa_key_free (my_private_key); | ||
1425 | my_private_key = NULL; | ||
1426 | } | ||
1427 | GNUNET_SCHEDULER_shutdown (); | 1406 | GNUNET_SCHEDULER_shutdown (); |
1428 | return; | 1407 | return; |
1429 | } | 1408 | } |
@@ -1437,8 +1416,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1437 | &find_proof, NULL); | 1416 | &find_proof, NULL); |
1438 | 1417 | ||
1439 | peers = GNUNET_CONTAINER_multihashmap_create (128); | 1418 | peers = GNUNET_CONTAINER_multihashmap_create (128); |
1440 | GNUNET_SERVER_add_handlers (server, handlers); | 1419 | GNUNET_SERVER_add_handlers (srv, handlers); |
1441 | nc = GNUNET_SERVER_notification_context_create (server, 1); | 1420 | nc = GNUNET_SERVER_notification_context_create (srv, 1); |
1442 | /* Connect to core service and register core handlers */ | 1421 | /* Connect to core service and register core handlers */ |
1443 | coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */ | 1422 | coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */ |
1444 | NULL, /* Closure passed to functions */ | 1423 | NULL, /* Closure passed to functions */ |
@@ -1450,8 +1429,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1450 | NULL, /* Don't want notified about all outbound messages */ | 1429 | NULL, /* Don't want notified about all outbound messages */ |
1451 | GNUNET_NO, /* For header only outbound notification */ | 1430 | GNUNET_NO, /* For header only outbound notification */ |
1452 | core_handlers); /* Register these handlers */ | 1431 | core_handlers); /* Register these handlers */ |
1453 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 1432 | if (NULL == coreAPI) |
1454 | NULL); | 1433 | { |
1434 | GNUNET_SCHEDULER_shutdown (); | ||
1435 | return; | ||
1436 | } | ||
1455 | #if ENABLE_HISTOGRAM | 1437 | #if ENABLE_HISTOGRAM |
1456 | if (GNUNET_OK == | 1438 | if (GNUNET_OK == |
1457 | GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "HISTOGRAM", &proof)) | 1439 | GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "HISTOGRAM", &proof)) |
@@ -1460,17 +1442,70 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1460 | GNUNET_free (proof); | 1442 | GNUNET_free (proof); |
1461 | } | 1443 | } |
1462 | #endif | 1444 | #endif |
1463 | if (coreAPI == NULL) | 1445 | stats = GNUNET_STATISTICS_create ("nse", cfg); |
1446 | GNUNET_SERVER_resume (srv); | ||
1447 | } | ||
1448 | |||
1449 | |||
1450 | /** | ||
1451 | * Handle network size estimate clients. | ||
1452 | * | ||
1453 | * @param cls closure | ||
1454 | * @param server the initialized server | ||
1455 | * @param c configuration to use | ||
1456 | */ | ||
1457 | static void | ||
1458 | run (void *cls, | ||
1459 | struct GNUNET_SERVER_Handle *server, | ||
1460 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
1461 | { | ||
1462 | char *keyfile; | ||
1463 | |||
1464 | cfg = c; | ||
1465 | srv = server; | ||
1466 | if ((GNUNET_OK != | ||
1467 | GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "INTERVAL", | ||
1468 | &gnunet_nse_interval)) || | ||
1469 | (GNUNET_OK != | ||
1470 | GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", "WORKDELAY", | ||
1471 | &proof_find_delay)) || | ||
1472 | (GNUNET_OK != | ||
1473 | GNUNET_CONFIGURATION_get_value_number (cfg, "NSE", "WORKBITS", | ||
1474 | &nse_work_required))) | ||
1464 | { | 1475 | { |
1476 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1477 | _ | ||
1478 | ("NSE service is lacking key configuration settings. Exiting.\n")); | ||
1465 | GNUNET_SCHEDULER_shutdown (); | 1479 | GNUNET_SCHEDULER_shutdown (); |
1466 | return; | 1480 | return; |
1467 | } | 1481 | } |
1468 | stats = GNUNET_STATISTICS_create ("nse", cfg); | 1482 | if (nse_work_required >= sizeof (struct GNUNET_HashCode) * 8) |
1483 | { | ||
1484 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1485 | _("Invalid work requirement for NSE service. Exiting.\n")); | ||
1486 | GNUNET_SCHEDULER_shutdown (); | ||
1487 | return; | ||
1488 | } | ||
1489 | if (GNUNET_OK != | ||
1490 | GNUNET_CONFIGURATION_get_value_filename (cfg, "GNUNETD", "HOSTKEY", | ||
1491 | &keyfile)) | ||
1492 | { | ||
1493 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1494 | _ | ||
1495 | ("NSE service is lacking key configuration settings. Exiting.\n")); | ||
1496 | GNUNET_SCHEDULER_shutdown (); | ||
1497 | return; | ||
1498 | } | ||
1499 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | ||
1500 | NULL); | ||
1501 | GNUNET_SERVER_suspend (srv); | ||
1502 | keygen = GNUNET_CRYPTO_rsa_key_create_start (keyfile, &key_generation_cb, NULL); | ||
1503 | GNUNET_free (keyfile); | ||
1469 | } | 1504 | } |
1470 | 1505 | ||
1471 | 1506 | ||
1472 | /** | 1507 | /** |
1473 | * The main function for the statistics service. | 1508 | * The main function for the network size estimation service. |
1474 | * | 1509 | * |
1475 | * @param argc number of arguments from the command line | 1510 | * @param argc number of arguments from the command line |
1476 | * @param argv command line arguments | 1511 | * @param argv command line arguments |