aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-11-12 00:47:35 +0000
committerBart Polot <bart@net.in.tum.de>2011-11-12 00:47:35 +0000
commit14c3c77ea2bbac38dc30e1505600d1a41a1c7605 (patch)
tree04b8db3b2446cc8a161c8864ac00029490432e12
parent4acf4de35680033d0a05463a7478bbfb4b407a94 (diff)
downloadgnunet-14c3c77ea2bbac38dc30e1505600d1a41a1c7605.tar.gz
gnunet-14c3c77ea2bbac38dc30e1505600d1a41a1c7605.zip
Fixed mantis #1896: check whether incoming tunnel is new before notifying clients
-rw-r--r--src/mesh/gnunet-service-mesh.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 7665909e6..ef1ba1f8a 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -2572,20 +2572,31 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2572 if (own_pos == size - 1) 2572 if (own_pos == size - 1)
2573 { 2573 {
2574 /* It is for us! Send ack. */ 2574 /* It is for us! Send ack. */
2575 struct GNUNET_MESH_TunnelNotification cmsg;
2576 struct MeshDataDescriptor *info; 2575 struct MeshDataDescriptor *info;
2577 unsigned int j; 2576 unsigned int j;
2578 2577
2579 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: It's for us!\n"); 2578 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: It's for us!\n");
2580 peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO); 2579 peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO);
2581 if (NULL == t->peers) 2580 if (NULL == t->peers)
2581 {
2582 /* New tunnel! Notify clients! */
2583 struct GNUNET_MESH_TunnelNotification cmsg;
2584
2585 cmsg.header.size = htons (sizeof (cmsg));
2586 cmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
2587 GNUNET_PEER_resolve (t->id.oid, &cmsg.peer);
2588 cmsg.tunnel_id = htonl (t->local_tid);
2589 GNUNET_SERVER_notification_context_broadcast (nc, &cmsg.header,
2590 GNUNET_NO);
2591
2582 t->peers = GNUNET_CONTAINER_multihashmap_create (4); 2592 t->peers = GNUNET_CONTAINER_multihashmap_create (4);
2593 }
2583 GNUNET_break (GNUNET_OK == 2594 GNUNET_break (GNUNET_OK ==
2584 GNUNET_CONTAINER_multihashmap_put (t->peers, 2595 GNUNET_CONTAINER_multihashmap_put (t->peers,
2585 &my_full_id.hashPubKey, 2596 &my_full_id.hashPubKey,
2586 peer_info_get 2597 peer_info_get
2587 (&my_full_id), 2598 (&my_full_id),
2588 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 2599 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE));
2589 /* FIXME use send_message */ 2600 /* FIXME use send_message */
2590 info = GNUNET_malloc (sizeof (struct MeshDataDescriptor)); 2601 info = GNUNET_malloc (sizeof (struct MeshDataDescriptor));
2591 info->origin = &t->id; 2602 info->origin = &t->id;
@@ -2600,11 +2611,6 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2600 GNUNET_TIME_UNIT_FOREVER_REL, peer, 2611 GNUNET_TIME_UNIT_FOREVER_REL, peer,
2601 sizeof (struct GNUNET_MESH_PathACK), 2612 sizeof (struct GNUNET_MESH_PathACK),
2602 &send_core_path_ack, info); 2613 &send_core_path_ack, info);
2603 cmsg.header.size = htons (sizeof (cmsg));
2604 cmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
2605 GNUNET_PEER_resolve (t->id.oid, &cmsg.peer);
2606 cmsg.tunnel_id = htonl (t->local_tid);
2607 GNUNET_SERVER_notification_context_broadcast (nc, &cmsg.header, GNUNET_NO);
2608 } 2614 }
2609 else 2615 else
2610 { 2616 {