aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-18 12:47:58 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-18 12:47:58 +0000
commit7c6b8edcc300e1be76803a9b80bfd720ddf0283a (patch)
tree2f16f93ff5d246346165b0f1379042887141147d /src/mesh
parenteaed2cc24c95f9c6188182b1373459d0855015b1 (diff)
downloadgnunet-7c6b8edcc300e1be76803a9b80bfd720ddf0283a.tar.gz
gnunet-7c6b8edcc300e1be76803a9b80bfd720ddf0283a.zip
Implemented workaround for #2071
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index de8fe68a9..637005048 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -276,6 +276,11 @@ struct MeshTunnel
276 */ 276 */
277 MESH_TunnelNumber local_tid; 277 MESH_TunnelNumber local_tid;
278 278
279 /**
280 * Local tunnel number for local destination clients
281 */
282 MESH_TunnelNumber local_tid_dest;
283
279 /** 284 /**
280 * ID of the last multicast packet seen/sent. 285 * ID of the last multicast packet seen/sent.
281 */ 286 */
@@ -834,7 +839,11 @@ send_subscribed_clients (const struct GNUNET_MessageHeader *msg,
834 GNUNET_break (0); 839 GNUNET_break (0);
835 return 0; 840 return 0;
836 } 841 }
837 *tid = htonl (t->local_tid); 842 // FIXME proper client differentiation mechanism required
843 if (htons (msg->type) == GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN)
844 *tid = htonl (t->local_tid);
845 else
846 *tid = htonl (t->local_tid_dest != 0 ? t->local_tid_dest : t->local_tid);
838 for (count = 0, c = clients; c != NULL; c = c->next) 847 for (count = 0, c = clients; c != NULL; c = c->next)
839 { 848 {
840#if MESH_DEBUG 849#if MESH_DEBUG
@@ -2529,9 +2538,9 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2529 2538
2530 tid = ntohl (msg->tid); 2539 tid = ntohl (msg->tid);
2531 pi = (struct GNUNET_PeerIdentity *) &msg[1]; 2540 pi = (struct GNUNET_PeerIdentity *) &msg[1];
2532 t = tunnel_get (pi, tid);
2533 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2541 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2534 "MESH: path is for tunnel %s [%X].\n", GNUNET_i2s (pi), tid); 2542 "MESH: path is for tunnel %s [%X].\n", GNUNET_i2s (pi), tid);
2543 t = tunnel_get (pi, tid);
2535 if (NULL == t) 2544 if (NULL == t)
2536 { 2545 {
2537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Creating tunnel\n"); 2546 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Creating tunnel\n");
@@ -3891,8 +3900,12 @@ handle_local_connect_by_type (void *cls, struct GNUNET_SERVER_Client *client,
3891 GNUNET_YES) 3900 GNUNET_YES)
3892 { 3901 {
3893 /* Yes! Fast forward, add ourselves to the tunnel and send the 3902 /* Yes! Fast forward, add ourselves to the tunnel and send the
3894 * good news to the client 3903 * good news to the client, and alert the destination client of
3904 * an incoming tunnel.
3895 */ 3905 */
3906 struct GNUNET_MESH_TunnelNotification cmsg;
3907 struct MeshClient *c;
3908
3896 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: available locally\n"); 3909 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: available locally\n");
3897 GNUNET_CONTAINER_multihashmap_put (t->peers, &my_full_id.hashPubKey, 3910 GNUNET_CONTAINER_multihashmap_put (t->peers, &my_full_id.hashPubKey,
3898 peer_info_get (&my_full_id), 3911 peer_info_get (&my_full_id),
@@ -3902,6 +3915,20 @@ handle_local_connect_by_type (void *cls, struct GNUNET_SERVER_Client *client,
3902 send_client_peer_connected (t, myid); 3915 send_client_peer_connected (t, myid);
3903 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Done\n"); 3916 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Done\n");
3904 GNUNET_SERVER_receive_done (client, GNUNET_OK); 3917 GNUNET_SERVER_receive_done (client, GNUNET_OK);
3918
3919 /* FIXME implement a proper handling of this case,
3920 a client differentiation mechanism */
3921 cmsg.header.size = htons (sizeof (cmsg));
3922 cmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
3923 cmsg.peer = my_full_id;
3924 t->local_tid_dest = next_local_tid++;
3925 cmsg.tunnel_id = htonl (t->local_tid_dest);
3926 c = (struct MeshClient *) GNUNET_CONTAINER_multihashmap_get(applications,
3927 &hash);
3928 GNUNET_SERVER_notification_context_unicast (nc, c->handle, &cmsg.header,
3929 GNUNET_NO);
3930
3931
3905 return; 3932 return;
3906 } 3933 }
3907 /* Ok, lets find a peer offering the service */ 3934 /* Ok, lets find a peer offering the service */