[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30100 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30100 - gnunet/src/mesh |
Date: |
Thu, 10 Oct 2013 16:44:22 +0200 |
Author: bartpolot
Date: 2013-10-10 16:44:22 +0200 (Thu, 10 Oct 2013)
New Revision: 30100
Modified:
gnunet/src/mesh/gnunet-service-mesh-enc.c
gnunet/src/mesh/gnunet-service-mesh_connection.c
gnunet/src/mesh/gnunet-service-mesh_dht.c
gnunet/src/mesh/gnunet-service-mesh_peer.c
Log:
- share ID
Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c 2013-10-10 14:42:45 UTC (rev
30099)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c 2013-10-10 14:44:22 UTC (rev
30100)
@@ -79,18 +79,18 @@
*/
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.
*/
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-10-10 14:42:45 UTC
(rev 30099)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-10-10 14:44:22 UTC
(rev 30100)
@@ -212,6 +212,11 @@
extern struct GNUNET_STATISTICS_Handle *stats;
/**
+ * Local peer own ID (memory efficient handle).
+ */
+extern GNUNET_PEER_Id myid;
+
+/**
* Connections known, indexed by cid (MeshConnection).
*/
static struct GNUNET_CONTAINER_MultiHashMap *connections;
@@ -1046,7 +1051,7 @@
if (path->peers[i] == my_short_id)
own_pos = i;
}
- if (own_pos == 0 && path->peers[own_pos] != myid)
+ if (own_pos == 0 && path->peers[own_pos] != my_short_id)
{
/* create path: self not found in path through self */
GNUNET_break_op (0);
@@ -1055,7 +1060,7 @@
return GNUNET_OK;
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
- path_add_to_peers (path, GNUNET_NO);
+ GMP_add_path_to_all (path, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
c = GMC_new (cid, NULL, path_duplicate (path), own_pos);
if (NULL == c)
Modified: gnunet/src/mesh/gnunet-service-mesh_dht.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_dht.c 2013-10-10 14:42:45 UTC (rev
30099)
+++ gnunet/src/mesh/gnunet-service-mesh_dht.c 2013-10-10 14:44:22 UTC (rev
30100)
@@ -62,6 +62,16 @@
extern struct GNUNET_STATISTICS_Handle *stats;
/**
+ * Own ID (short value).
+ */
+extern GNUNET_PEER_Id myid;
+
+/**
+ * Own ID (full value).
+ */
+extern struct GNUNET_PeerIdentity my_full_id;
+
+/**
* Handle to use DHT.
*/
static struct GNUNET_DHT_Handle *dht_handle;
@@ -82,16 +92,6 @@
static GNUNET_SCHEDULER_TaskIdentifier announce_id_task;
/**
- * Own ID (short value).
- */
-static GNUNET_PEER_Id short_id;
-
-/**
- * Own ID (full value).
- */
-static struct GNUNET_PeerIdentity *full_id;
-
-/**
* Own private key.
*/
static struct GNUNET_CRYPTO_EddsaPrivateKey *private_key;
@@ -248,8 +248,8 @@
* - Set data expiration in function of X
* - Adapt X to churn
*/
- block.id = *full_id;
- GNUNET_CRYPTO_hash (full_id, sizeof (struct GNUNET_PeerIdentity), &phash);
+ block.id = my_full_id;
+ GNUNET_CRYPTO_hash (&my_full_id, sizeof (struct GNUNET_PeerIdentity),
&phash);
GNUNET_DHT_put (dht_handle, /* DHT handle */
&phash, /* Key to use */
dht_replication_level, /* Replication level */
@@ -277,15 +277,14 @@
* @param peer_id Local peer ID (must remain valid during all execution time).
*/
void
-GMD_init (const struct GNUNET_CONFIGURATION_Handle *c,
- struct GNUNET_PeerIdentity *peer_id)
+GMD_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
- full_id = peer_id;
+
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c, "MESH",
"DHT_REPLICATION_LEVEL",
&dht_replication_level))
{
- LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "DHT_REPLICATION_LEVEL", "USING
DEFAULT");
dht_replication_level = 3;
}
@@ -294,7 +293,7 @@
GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME",
&id_announce_time))
{
- LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"MESH", "ID_ANNOUNCE_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2013-10-10 14:42:45 UTC (rev
30099)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2013-10-10 14:44:22 UTC (rev
30100)
@@ -178,6 +178,16 @@
extern struct GNUNET_STATISTICS_Handle *stats;
/**
+ * Local peer own ID (full value).
+ */
+extern struct GNUNET_PeerIdentity my_full_id;
+
+/**
+ * Local peer own ID (short)
+ */
+extern GNUNET_PEER_Id myid;
+
+/**
* Peers known, indexed by PeerIdentity (MeshPeer).
*/
static struct GNUNET_CONTAINER_MultiPeerMap *peers;
@@ -197,16 +207,7 @@
*/
static struct GNUNET_CORE_Handle *core_handle;
-/**
- * Local peer own ID (full value).
- */
-const static struct GNUNET_PeerIdentity *my_full_id;
-/**
- * Local peer own ID (short)
- */
-static GNUNET_PEER_Id my_short_id;
-
/******************************************************************************/
/***************************** CORE CALLBACKS
*********************************/
/******************************************************************************/
@@ -231,7 +232,7 @@
struct MeshPeer *peer = cls;
struct MeshConnection *c = value;
- GMC_notify_broken (c, peer, my_full_id);
+ GMC_notify_broken (c, peer, &my_full_id);
return GNUNET_YES;
}
@@ -1319,18 +1320,14 @@
* @param id Peer identity
*/
void
-GMP_init (const struct GNUNET_CONFIGURATION_Handle *c,
- const struct GNUNET_PeerIdentity *id)
+GMP_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
- my_full_id = id;
- my_short_id = GNUNET_PEER_intern (id);
-
peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_PEERS",
&max_peers))
{
- LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "MAX_PEERS", "USING DEFAULT");
max_peers = 1000;
}
@@ -1382,7 +1379,7 @@
GNUNET_CORE_disconnect (core_handle);
core_handle = NULL;
}
- GNUNET_PEER_change_rc (my_short_id, -1);
+ GNUNET_PEER_change_rc (myid, -1);
}
@@ -1652,7 +1649,7 @@
unsigned int i;
/* TODO: invert and add */
- for (i = 0; i < p->length && p->peers[i] != my_short_id; i++) /* skip'em */ ;
+ for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ;
for (i++; i < p->length; i++)
{
struct MeshPeer *aux;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30100 - gnunet/src/mesh,
gnunet <=