diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 77986f90c..9af81333a 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -818,7 +818,7 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *const *get_path, | |||
818 | GNUNET_PEER_Id id; | 818 | GNUNET_PEER_Id id; |
819 | int i; | 819 | int i; |
820 | 820 | ||
821 | p = GNUNET_malloc (sizeof (struct MeshPeerPath)); | 821 | p = path_new (0); |
822 | for (i = 0; get_path[i] != NULL; i++) ; | 822 | for (i = 0; get_path[i] != NULL; i++) ; |
823 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESH: GET has %d hops.\n", i); | 823 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESH: GET has %d hops.\n", i); |
824 | for (i--; i >= 0; i--) | 824 | for (i--; i >= 0; i--) |
@@ -1606,9 +1606,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1606 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1606 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | path = GNUNET_malloc (sizeof (struct MeshPeerPath)); | 1609 | path = path_new (size); |
1610 | path->length = size; | ||
1611 | path->peers = GNUNET_malloc (size * sizeof (GNUNET_PEER_Id)); | ||
1612 | own_pos = 0; | 1610 | own_pos = 0; |
1613 | for (i = 0; i < size; i++) | 1611 | for (i = 0; i < size; i++) |
1614 | { | 1612 | { |
@@ -1781,7 +1779,7 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1781 | * Using path here as just a collection of peers, not a path per se. | 1779 | * Using path here as just a collection of peers, not a path per se. |
1782 | */ | 1780 | */ |
1783 | neighbors.t = t; | 1781 | neighbors.t = t; |
1784 | neighbors.path = GNUNET_malloc (sizeof (struct MeshPeerPath)); | 1782 | neighbors.path = path_new (0); |
1785 | GNUNET_CONTAINER_multihashmap_iterate (t->peers, &iterate_collect_neighbors, | 1783 | GNUNET_CONTAINER_multihashmap_iterate (t->peers, &iterate_collect_neighbors, |
1786 | &neighbors); | 1784 | &neighbors); |
1787 | if (0 == neighbors.path->length) | 1785 | if (0 == neighbors.path->length) |
@@ -2459,14 +2457,9 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
2459 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2457 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
2460 | return; | 2458 | return; |
2461 | } | 2459 | } |
2462 | t->tree = GNUNET_malloc (sizeof(struct MeshTunnelTree)); | 2460 | t->tree = tree_new (t, myid); |
2463 | t->tree->first_hops = GNUNET_CONTAINER_multihashmap_create(32); | ||
2464 | t->tree->t = t; | ||
2465 | t->tree->refresh = REFRESH_PATH_TIME; | 2461 | t->tree->refresh = REFRESH_PATH_TIME; |
2466 | t->tree->root = GNUNET_malloc(sizeof(struct MeshTunnelTreeNode)); | ||
2467 | t->tree->root->status = MESH_PEER_READY; | 2462 | t->tree->root->status = MESH_PEER_READY; |
2468 | t->tree->root->t = t; | ||
2469 | t->tree->root->peer = myid; | ||
2470 | t->tree->me = t->tree->root; | 2463 | t->tree->me = t->tree->root; |
2471 | 2464 | ||
2472 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2465 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -2981,9 +2974,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2981 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (self)\n"); | 2974 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (self)\n"); |
2982 | return; | 2975 | return; |
2983 | } | 2976 | } |
2984 | path = GNUNET_malloc (sizeof (struct MeshPeerPath)); | 2977 | path = path_new (2); |
2985 | path->length = 2; | ||
2986 | path->peers = GNUNET_malloc (sizeof (GNUNET_PEER_Id) * 2); | ||
2987 | path->peers[0] = myid; | 2978 | path->peers[0] = myid; |
2988 | path->peers[1] = peer_info->id; | 2979 | path->peers[1] = peer_info->id; |
2989 | path_add_to_peer (peer_info, path); | 2980 | path_add_to_peer (peer_info, path); |
@@ -3165,9 +3156,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
3165 | 3156 | ||
3166 | /* Create a peer_info for the local peer */ | 3157 | /* Create a peer_info for the local peer */ |
3167 | peer = peer_info_get(&my_full_id); | 3158 | peer = peer_info_get(&my_full_id); |
3168 | p = GNUNET_malloc (sizeof (struct MeshPeerPath)); | 3159 | p = path_new (1); |
3169 | p->peers = GNUNET_malloc (sizeof (GNUNET_PEER_Id)); | ||
3170 | p->length = 1; | ||
3171 | p->peers[0] = myid; | 3160 | p->peers[0] = myid; |
3172 | path_add_to_peer(peer, p); | 3161 | path_add_to_peer(peer, p); |
3173 | 3162 | ||