From 5c21d6d533a6ff9dcb35344dc24d5d460bc9cf7c Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Mon, 9 Dec 2013 12:54:49 +0000 Subject: [PATCH] -fixed 3174 part 1 --- src/mesh/gnunet-service-mesh_channel.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index ba9485fdc..bd5603e38 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c @@ -316,7 +316,7 @@ extern GNUNET_PEER_Id myid; * is skewed by the retransmission, count only for the * retransmitted message. */ -static void +static int rel_message_free (struct MeshReliableMessage *copy, int update_time); /** @@ -993,7 +993,7 @@ channel_rel_free_sent (struct MeshChannelReliability *rel, /* Now copy->mid == target, free it */ next = copy->next; - rel_message_free (copy, GNUNET_YES); + GNUNET_break (GNUNET_YES != rel_message_free (copy, GNUNET_YES)); copy = next; } LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable END\n"); @@ -1010,8 +1010,11 @@ channel_rel_free_sent (struct MeshChannelReliability *rel, * If this message is ACK in a batch the timing information * is skewed by the retransmission, count only for the * retransmitted message. + * + * @return #GNUNET_YES if channel was destroyed as a result of the call, + * #GNUNET_NO otherwise. */ -static void +static int rel_message_free (struct MeshReliableMessage *copy, int update_time) { struct MeshChannelReliability *rel; @@ -1056,7 +1059,9 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time) struct MeshTunnel3 *t = rel->ch->t; GMCH_destroy (rel->ch); GMT_destroy_if_empty (t); + return GNUNET_YES; } + return GNUNET_NO; } @@ -1954,7 +1959,8 @@ GMCH_handle_data_ack (struct MeshChannel *ch, work = GNUNET_YES; LOG (GNUNET_ERROR_TYPE_DEBUG, " !! id %u\n", copy->mid); next = copy->next; - rel_message_free (copy, GNUNET_YES); + if (GNUNET_YES == rel_message_free (copy, GNUNET_YES)) + return; } /* ACK client if needed */ -- 2.25.1