aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesh/gnunet-service-mesh.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 59c5174ac..6e0af467b 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -1130,7 +1130,7 @@ send_core_data_raw (void *cls, size_t size, void *buf)
1130 * Sends an already built message to a peer, properly registrating 1130 * Sends an already built message to a peer, properly registrating
1131 * all used resources. 1131 * all used resources.
1132 * 1132 *
1133 * @param message Message to send. 1133 * @param message Message to send. Fucntion makes a copy of it.
1134 * @param peer Short ID of the neighbor whom to send the message. 1134 * @param peer Short ID of the neighbor whom to send the message.
1135 */ 1135 */
1136static void 1136static void
@@ -1236,10 +1236,7 @@ send_create_path (struct MeshPeerInfo *peer,
1236static void 1236static void
1237send_destroy_path (struct MeshTunnel *t, GNUNET_PEER_Id destination) 1237send_destroy_path (struct MeshTunnel *t, GNUNET_PEER_Id destination)
1238{ 1238{
1239 struct GNUNET_MESH_ManipulatePath *msg;
1240 struct GNUNET_PeerIdentity *pi;
1241 struct MeshPeerPath *p; 1239 struct MeshPeerPath *p;
1242 unsigned int i;
1243 size_t size; 1240 size_t size;
1244 1241
1245 p = tree_get_path_to_peer(t->tree, destination); 1242 p = tree_get_path_to_peer(t->tree, destination);
@@ -1250,16 +1247,23 @@ send_destroy_path (struct MeshTunnel *t, GNUNET_PEER_Id destination)
1250 } 1247 }
1251 size = sizeof (struct GNUNET_MESH_ManipulatePath); 1248 size = sizeof (struct GNUNET_MESH_ManipulatePath);
1252 size += p->length * sizeof (struct GNUNET_PeerIdentity); 1249 size += p->length * sizeof (struct GNUNET_PeerIdentity);
1253 msg = GNUNET_malloc (size);
1254 msg->header.size = htons (size);
1255 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY);
1256 msg->tid = htonl (t->id.tid);
1257 pi = (struct GNUNET_PeerIdentity *) &msg[1];
1258 for (i = 0; i < p->length; i++)
1259 { 1250 {
1260 GNUNET_PEER_resolve(p->peers[i], &pi[i]); 1251 struct GNUNET_MESH_ManipulatePath *msg;
1252 struct GNUNET_PeerIdentity *pi;
1253 char cbuf[size];
1254 unsigned int i;
1255
1256 msg = (struct GNUNET_MESH_ManipulatePath *) cbuf;
1257 msg->header.size = htons (size);
1258 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY);
1259 msg->tid = htonl (t->id.tid);
1260 pi = (struct GNUNET_PeerIdentity *) &msg[1];
1261 for (i = 0; i < p->length; i++)
1262 {
1263 GNUNET_PEER_resolve(p->peers[i], &pi[i]);
1264 }
1265 send_message (&msg->header, path_get_first_hop(t->tree, destination));
1261 } 1266 }
1262 send_message (&msg->header, path_get_first_hop(t->tree, destination));
1263 path_destroy (p); 1267 path_destroy (p);
1264} 1268}
1265 1269