From 90b5375e31986484f5007ec62c57f455bb8178dc Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 17 Jul 2012 13:42:41 +0000 Subject: [PATCH] - fix #2498 --- src/mesh/gnunet-service-mesh.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 2082de58b..9fad532c5 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -858,6 +858,20 @@ static void regex_find_path (const struct GNUNET_HashCode *key, struct MeshRegexSearchContext *ctx); + +/** + * Queue and pass message to core when possible. + * + * @param cls Closure (type dependant). + * @param type Type of the message. + * @param size Size of the message. + * @param dst Neighbor to send message to. + * @param t Tunnel this message belongs to. + */ +static void +queue_add (void *cls, uint16_t type, size_t size, + struct MeshPeerInfo *dst, struct MeshTunnel *t); + /******************************************************************************/ /************************ ITERATORS ****************************/ /******************************************************************************/ @@ -1773,7 +1787,7 @@ static void data_descriptor_decrement_multicast (struct MeshData *mesh_data) { /* Make sure it's a multicast packet */ - GNUNET_assert (NULL != mesh_data->reference_counter); // FIXME URGENT #2499 + GNUNET_assert (NULL != mesh_data->reference_counter); if (0 == --(*(mesh_data->reference_counter))) { @@ -1872,19 +1886,6 @@ peer_info_delete_tunnel (void *cls, const struct GNUNET_HashCode * key, void *va } -/** - * Queue and pass message to core when possible. - * - * @param cls Closure (type dependant). - * @param type Type of the message. - * @param size Size of the message. - * @param dst Neighbor to send message to. - * @param t Tunnel this message belongs to. - */ -static void -queue_add (void *cls, uint16_t type, size_t size, - struct MeshPeerInfo *dst, struct MeshTunnel *t); - /** * Core callback to write a pre-constructed data packet to core buffer * @@ -1944,6 +1945,8 @@ send_message (const struct GNUNET_MessageHeader *message, info->mesh_data->data = GNUNET_malloc (size); memcpy (info->mesh_data->data, message, size); info->mesh_data->data_len = size; + info->mesh_data->reference_counter = GNUNET_malloc (sizeof (unsigned int)); + *info->mesh_data->reference_counter = 1; neighbor = peer_info_get (peer); for (p = neighbor->path_head; NULL != p; p = p->next) { -- 2.25.1