[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17393 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17393 - gnunet/src/mesh |
Date: |
Tue, 11 Oct 2011 19:22:27 +0200 |
Author: bartpolot
Date: 2011-10-11 19:22:27 +0200 (Tue, 11 Oct 2011)
New Revision: 17393
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/mesh_tunnel_tree.c
gnunet/src/mesh/test_mesh_small.conf
Log:
Fixes in path creation
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-10-11 17:07:45 UTC (rev
17392)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-10-11 17:22:27 UTC (rev
17393)
@@ -1235,13 +1235,15 @@
}
}
#if MESH_DEBUG
+ if (get_path_length > 0)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: (first of GET: %s)\n",
+ GNUNET_h2s_full(&get_path[0].hashPubKey));
+ if (put_path_length > 0)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: (first of PUT: %s)\n",
+ GNUNET_h2s_full(&put_path[0].hashPubKey));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: (first of GET: %s)\n",
- GNUNET_h2s_full(&get_path[0].hashPubKey));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: (first of PUT: %s)\n",
- GNUNET_h2s_full(&put_path[0].hashPubKey));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: In total: %d hops\n",
p->length);
for (i = 0; i < p->length; i++)
@@ -1412,8 +1414,6 @@
* Add a path to a tunnel which we don't own, just to remember the next hop.
* If destination node was already in the tunnel, the first hop information
* will be replaced with the new path.
- * The local node shouldn't be the first or last node in the path, just an
- * intermediate hop.
*
* @param t Tunnel we want to add a new peer to
* @param p Path to add
@@ -1425,20 +1425,8 @@
struct MeshPeerPath *p,
unsigned int own_pos)
{
- struct GNUNET_PeerIdentity id;
- struct GNUNET_PeerIdentity *hop;
-
- GNUNET_assert (own_pos < p->length - 1);
- hop = GNUNET_CONTAINER_multihashmap_get (t->tree->first_hops,
&id.hashPubKey);
- if (NULL == hop)
- hop = GNUNET_malloc (sizeof(struct GNUNET_PeerIdentity));
- GNUNET_PEER_resolve(p->peers[own_pos + 1], hop);
- GNUNET_PEER_resolve(p->peers[p->length - 1], &id);
- GNUNET_CONTAINER_multihashmap_put(
- t->tree->first_hops,
- &id.hashPubKey,
- hop,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ GNUNET_assert (0 != own_pos);
+ tree_add_path(t->tree, p, NULL);
}
@@ -1963,6 +1951,8 @@
/* FIXME error. destroy tunnel? leave for timeout? */
return 0;
}
+ tunnel_add_path (t, path, own_pos);
+ t->tree->me = tree_find_peer(t->tree->root, myid);
if (own_pos == size - 1)
{
/* It is for us! Send ack. */
@@ -1972,7 +1962,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: It's for us!\n");
- path_add_to_origin (orig_peer_info, path); /* inverts path! */
+ path_add_to_origin (orig_peer_info, path);
info = GNUNET_malloc (sizeof (struct MeshDataDescriptor));
info->origin = &t->id;
info->peer = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
@@ -1986,6 +1976,8 @@
}
}
info->handler_n = j;
+ info->peer->types[j] = GNUNET_MESSAGE_TYPE_MESH_PATH_ACK;
+ info->peer->infos[j] = info;
info->peer->core_transmit[j] =
GNUNET_CORE_notify_transmit_ready (core_handle, 0, 100,
GNUNET_TIME_UNIT_FOREVER_REL, peer,
@@ -2001,12 +1993,11 @@
{
struct MeshPeerPath *path2;
- path2 = path_duplicate(path);
/* It's for somebody else! Retransmit. */
+ path2 = path_duplicate(path);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: Retransmitting.\n");
path_add_to_peer(dest_peer_info, path);
- tunnel_add_path (t, path, own_pos);
path = path_duplicate(path2);
path_add_to_origin(orig_peer_info, path2);
send_create_path(dest_peer_info, path, t);
Modified: gnunet/src/mesh/mesh_tunnel_tree.c
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.c 2011-10-11 17:07:45 UTC (rev 17392)
+++ gnunet/src/mesh/mesh_tunnel_tree.c 2011-10-11 17:22:27 UTC (rev 17393)
@@ -313,7 +313,7 @@
{
tree_mark_peers_disconnected (tree, n, cb);
}
- if (MESH_PEER_READY == parent->status)
+ if (MESH_PEER_READY == parent->status && NULL != cb)
{
cb (parent);
}
@@ -420,7 +420,7 @@
return n;
}
}
- n = tree_find_peer (t->me, peer_id);
+ n = tree_find_peer (t->root, peer_id);
if (NULL == n)
return NULL;
node = n;
@@ -522,12 +522,14 @@
unsigned int i;
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "tree: Adding path [%u] towards peer %u to peer %u.\n",
+ "tree: Adding path [%u] towards peer %u.\n",
p->length,
- p->peers[p->length - 1],
- t->me->peer);
+ p->peers[p->length - 1]);
- myid = t->me->peer;
+ if (NULL != t->me)
+ myid = t->me->peer;
+ else
+ myid = 0;
GNUNET_assert(0 != p->length);
parent = n = t->root;
if (n->peer != p->peers[0])
@@ -571,12 +573,6 @@
}
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"tree: All childen visited.\n");
- if (-1 == me)
- {
- /* New path deviates from tree before reaching us. What happened? */
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
/* Add the rest of the path as a branch from parent. */
while (i < p->length)
{
Modified: gnunet/src/mesh/test_mesh_small.conf
===================================================================
--- gnunet/src/mesh/test_mesh_small.conf 2011-10-11 17:07:45 UTC (rev
17392)
+++ gnunet/src/mesh/test_mesh_small.conf 2011-10-11 17:22:27 UTC (rev
17393)
@@ -62,8 +62,8 @@
WEAKRANDOM = YES
TOPOLOGY = 2D_TORUS
CONNECT_TOPOLOGY = NONE
-TOPOLOGY_FILE = small.dat
-#CONNECT_TOPOLOGY = ERDOS_RENYI
+#TOPOLOGY_FILE = small.dat
+CONNECT_TOPOLOGY = 2D_TORUS
#CONNECT_TOPOLOGY_OPTION = CONNECT_MINIMUM
#CONNECT_TOPOLOGY_OPTION_MODIFIER = 25
#PERCENTAGE = 3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17393 - gnunet/src/mesh,
gnunet <=