[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17368 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17368 - gnunet/src/mesh |
Date: |
Tue, 11 Oct 2011 13:23:26 +0200 |
Author: bartpolot
Date: 2011-10-11 13:23:26 +0200 (Tue, 11 Oct 2011)
New Revision: 17368
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
Added mangaement of tunnels and paths by intermadiate nodes
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-10-11 11:19:37 UTC (rev
17367)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-10-11 11:23:26 UTC (rev
17368)
@@ -1409,15 +1409,36 @@
}
/**
- * Add a path to a tunnel, without evaluating costs.
+ * 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
+ * @param own_pos Position of local node in path.
*
*/
static void
-tunnel_add_path (struct MeshTunnel *t, struct MeshPeerPath *p)
+tunnel_add_path (struct MeshTunnel *t,
+ 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);
}
@@ -1985,7 +2006,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: Retransmitting.\n");
path_add_to_peer(dest_peer_info, path);
- tunnel_add_path (t, 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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17368 - gnunet/src/mesh,
gnunet <=