#include "platform.h"
#include "gnunet_util_lib.h"
#include "mesh_enc.h"
-#include "block_mesh.h"
#include "gnunet_statistics_service.h"
#include "gnunet-service-mesh_local.h"
*/
struct GNUNET_STATISTICS_Handle *stats;
-/*************************** Static global variables **************************/
-
/**
* Local peer own ID (memory efficient handle).
*/
-static GNUNET_PEER_Id myid;
+GNUNET_PEER_Id myid;
/**
* Local peer own ID (full value).
*/
-static struct GNUNET_PeerIdentity my_full_id;
+struct GNUNET_PeerIdentity my_full_id;
+
+/*************************** Static global variables **************************/
/**
* Own private key.
run (void *cls, struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n");
stats = GNUNET_STATISTICS_create ("mesh", c);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
NULL);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "reading key\n");
- pk = GNUNET_CRYPTO_eddsa_key_create_from_configuration (c);
- GNUNET_assert (NULL != pk);
- my_private_key = pk;
- GNUNET_CRYPTO_eddsa_key_get_public (my_private_key,
- &my_full_id.public_key);
+ my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (c);
+ GNUNET_assert (NULL != my_private_key);
+ GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key);
myid = GNUNET_PEER_intern (&my_full_id);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Mesh for peer [%s] starting\n",
GML_init (server); /* Local clients */
GMC_init (c); /* Connections */
GMP_init (c); /* Peers */
- GMD_init (c, &my_full_id); /* DHT */
- GMT_init (c, &my_full_id, my_private_key);
+ GMD_init (c); /* DHT */
+ GMT_init (c, my_private_key); /* Tunnels */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh service running\n");
}
int ret;
int r;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "main()\n");
+ fprintf (stderr, "main()\n");
r = GNUNET_SERVICE_run (argc, argv, "mesh", GNUNET_SERVICE_OPTION_NONE, &run,
NULL);
+ GNUNET_free (my_private_key);
ret = (GNUNET_OK == r) ? 0 : 1;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "main() END\n");
+ fprintf (stderr, "main() END\n");
return ret;
}