aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-11 10:52:56 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-11 10:52:56 +0000
commitb9be46016b86767ba9fc22609a705bd7dd0b89e8 (patch)
tree4f643a2bfa3fea8bba37c0798311fee174be1355 /src/mesh/gnunet-service-mesh.c
parentd615eab51d7976fa818498b2592dd1567da69fd8 (diff)
downloadgnunet-b9be46016b86767ba9fc22609a705bd7dd0b89e8.tar.gz
gnunet-b9be46016b86767ba9fc22609a705bd7dd0b89e8.zip
WiP
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 53feb309d..1f29e6c78 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -776,7 +776,7 @@ peer_info_cancel_transmission(struct MeshPeerInfo *peer, unsigned int i)
776 * 776 *
777 */ 777 */
778static unsigned int 778static unsigned int
779peer_info_transmit_position (struct MeshPeerInfo *peer) 779peer_info_transmit_slot (struct MeshPeerInfo *peer)
780{ 780{
781 unsigned int i; 781 unsigned int i;
782 782
@@ -858,7 +858,14 @@ send_create_path (struct MeshPeerInfo *peer,
858 unsigned int i; 858 unsigned int i;
859 859
860 if (NULL == p) 860 if (NULL == p)
861 {
861 p = tree_get_path_to_peer(t->tree, peer->id); 862 p = tree_get_path_to_peer(t->tree, peer->id);
863 if (NULL == p)
864 {
865 GNUNET_break (0);
866 return;
867 }
868 }
862 for (i = 0; i < p->length; i++) 869 for (i = 0; i < p->length; i++)
863 { 870 {
864 if (p->peers[i] == myid) 871 if (p->peers[i] == myid)
@@ -876,7 +883,7 @@ send_create_path (struct MeshPeerInfo *peer,
876 path_info->peer = peer; 883 path_info->peer = peer;
877 path_info->t = t; 884 path_info->t = t;
878 neighbor = peer_info_get(&id); 885 neighbor = peer_info_get(&id);
879 path_info->pos = peer_info_transmit_position(neighbor); 886 path_info->pos = peer_info_transmit_slot(neighbor);
880 neighbor->types[path_info->pos] = GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE; 887 neighbor->types[path_info->pos] = GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE;
881 neighbor->infos[path_info->pos] = path_info; 888 neighbor->infos[path_info->pos] = path_info;
882 neighbor->core_transmit[path_info->pos] = 889 neighbor->core_transmit[path_info->pos] =
@@ -890,7 +897,6 @@ send_create_path (struct MeshPeerInfo *peer,
890 + (p->length * sizeof (struct GNUNET_PeerIdentity)), /*size */ 897 + (p->length * sizeof (struct GNUNET_PeerIdentity)), /*size */
891 &send_core_create_path, /* callback */ 898 &send_core_create_path, /* callback */
892 path_info); /* cls */ 899 path_info); /* cls */
893
894} 900}
895 901
896 902
@@ -1402,6 +1408,18 @@ tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer)
1402 } 1408 }
1403} 1409}
1404 1410
1411/**
1412 * Add a path to a tunnel, without evaluating costs.
1413 *
1414 * @param t Tunnel we want to add a new peer to
1415 * @param p Path to add
1416 *
1417 */
1418static void
1419tunnel_add_path (struct MeshTunnel *t, struct MeshPeerPath *p)
1420{
1421}
1422
1405 1423
1406/** 1424/**
1407 * Notify a tunnel that a connection has broken that affects at least 1425 * Notify a tunnel that a connection has broken that affects at least
@@ -1967,7 +1985,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1967 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1985 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1968 "MESH: Retransmitting.\n"); 1986 "MESH: Retransmitting.\n");
1969 path_add_to_peer(dest_peer_info, path); 1987 path_add_to_peer(dest_peer_info, path);
1970 tunnel_add_peer(t, dest_peer_info); 1988 tunnel_add_path (t, path);
1971 path = path_duplicate(path2); 1989 path = path_duplicate(path2);
1972 path_add_to_origin(orig_peer_info, path2); 1990 path_add_to_origin(orig_peer_info, path2);
1973 send_create_path(dest_peer_info, path, t); 1991 send_create_path(dest_peer_info, path, t);