projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4add4c6
)
- share ID
author
Bart Polot
<bart@net.in.tum.de>
Thu, 10 Oct 2013 14:44:22 +0000
(14:44 +0000)
committer
Bart Polot
<bart@net.in.tum.de>
Thu, 10 Oct 2013 14:44:22 +0000
(14:44 +0000)
src/mesh/gnunet-service-mesh-enc.c
patch
|
blob
|
history
src/mesh/gnunet-service-mesh_connection.c
patch
|
blob
|
history
src/mesh/gnunet-service-mesh_dht.c
patch
|
blob
|
history
src/mesh/gnunet-service-mesh_peer.c
patch
|
blob
|
history
diff --git
a/src/mesh/gnunet-service-mesh-enc.c
b/src/mesh/gnunet-service-mesh-enc.c
index 0a3aeaf3550c90e93b37e5779e8c75efefca9ae0..8a2b60da7d87898755c26c091e63c8ca9f422167 100644
(file)
--- a/
src/mesh/gnunet-service-mesh-enc.c
+++ b/
src/mesh/gnunet-service-mesh-enc.c
@@
-79,17
+79,17
@@
*/
struct GNUNET_STATISTICS_Handle *stats;
*/
struct GNUNET_STATISTICS_Handle *stats;
-/*************************** Static global variables **************************/
-
/**
* Local peer own ID (memory efficient handle).
*/
/**
* Local peer own ID (memory efficient handle).
*/
-
static
GNUNET_PEER_Id myid;
+GNUNET_PEER_Id myid;
/**
* Local peer own ID (full value).
*/
/**
* 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.
/**
* Own private key.
diff --git
a/src/mesh/gnunet-service-mesh_connection.c
b/src/mesh/gnunet-service-mesh_connection.c
index 9a58bf8437342f623bc7900adbf54aebf5fd4e41..8f598b2b5908e42d483d4117b16b7f1605054ae9 100644
(file)
--- a/
src/mesh/gnunet-service-mesh_connection.c
+++ b/
src/mesh/gnunet-service-mesh_connection.c
@@
-211,6
+211,11
@@
struct MeshConnection
*/
extern struct GNUNET_STATISTICS_Handle *stats;
*/
extern struct GNUNET_STATISTICS_Handle *stats;
+/**
+ * Local peer own ID (memory efficient handle).
+ */
+extern GNUNET_PEER_Id myid;
+
/**
* Connections known, indexed by cid (MeshConnection).
*/
/**
* Connections known, indexed by cid (MeshConnection).
*/
@@
-1046,7
+1051,7
@@
GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
if (path->peers[i] == my_short_id)
own_pos = i;
}
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);
{
/* create path: self not found in path through self */
GNUNET_break_op (0);
@@
-1055,7
+1060,7
@@
GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
return GNUNET_OK;
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
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)
LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
c = GMC_new (cid, NULL, path_duplicate (path), own_pos);
if (NULL == c)
diff --git
a/src/mesh/gnunet-service-mesh_dht.c
b/src/mesh/gnunet-service-mesh_dht.c
index 00dfb9d4699f2414f03d7c4c295d222bbe278f24..4587041a4ed3e74f4b233f9f9be724ef764e1fbe 100644
(file)
--- a/
src/mesh/gnunet-service-mesh_dht.c
+++ b/
src/mesh/gnunet-service-mesh_dht.c
@@
-61,6
+61,16
@@
struct GMD_search_handle
*/
extern struct GNUNET_STATISTICS_Handle *stats;
*/
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.
*/
/**
* Handle to use DHT.
*/
@@
-81,16
+91,6
@@
static unsigned long long dht_replication_level;
*/
static GNUNET_SCHEDULER_TaskIdentifier announce_id_task;
*/
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.
*/
/**
* Own private key.
*/
@@
-248,8
+248,8
@@
announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* - Set data expiration in function of X
* - Adapt X to churn
*/
* - 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 */
GNUNET_DHT_put (dht_handle, /* DHT handle */
&phash, /* Key to use */
dht_replication_level, /* Replication level */
@@
-277,15
+277,14
@@
announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param peer_id Local peer ID (must remain valid during all execution time).
*/
void
* @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))
{
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;
}
"MESH", "DHT_REPLICATION_LEVEL", "USING DEFAULT");
dht_replication_level = 3;
}
@@
-294,7
+293,7
@@
GMD_init (const struct GNUNET_CONFIGURATION_Handle *c,
GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME",
&id_announce_time))
{
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;
"MESH", "ID_ANNOUNCE_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
diff --git
a/src/mesh/gnunet-service-mesh_peer.c
b/src/mesh/gnunet-service-mesh_peer.c
index a4e17cefca6cd49f57539707067e979c4a9ec62b..48d5eda7cd733f31186e2a336771b1c1ca0c08d3 100644
(file)
--- a/
src/mesh/gnunet-service-mesh_peer.c
+++ b/
src/mesh/gnunet-service-mesh_peer.c
@@
-177,6
+177,16
@@
struct MeshPeer
*/
extern struct GNUNET_STATISTICS_Handle *stats;
*/
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).
*/
/**
* Peers known, indexed by PeerIdentity (MeshPeer).
*/
@@
-197,15
+207,6
@@
static unsigned long long drop_percent;
*/
static struct GNUNET_CORE_Handle *core_handle;
*/
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 *********************************/
/******************************************************************************/
/***************************** CORE CALLBACKS *********************************/
@@
-231,7
+232,7
@@
notify_broken (void *cls,
struct MeshPeer *peer = cls;
struct MeshConnection *c = value;
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;
}
return GNUNET_YES;
}
@@
-1319,18
+1320,14
@@
GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c)
* @param id Peer identity
*/
void
* @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))
{
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;
}
"MESH", "MAX_PEERS", "USING DEFAULT");
max_peers = 1000;
}
@@
-1382,7
+1379,7
@@
GMP_shutdown (void)
GNUNET_CORE_disconnect (core_handle);
core_handle = NULL;
}
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
@@
GMP_add_path_to_all (struct MeshPeerPath *p, int confirmed)
unsigned int i;
/* TODO: invert and add */
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;
for (i++; i < p->length; i++)
{
struct MeshPeer *aux;