aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-22 11:47:37 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-22 11:47:37 +0000
commit221498151499b94eb1b2eea73be29d098b803a06 (patch)
tree3bdb8999b9be433531b55f7957bc0a5982a9711f /src/util
parent76a029cc8d1dbf3d470079e98be1f3b7c4783ef0 (diff)
downloadgnunet-221498151499b94eb1b2eea73be29d098b803a06.tar.gz
gnunet-221498151499b94eb1b2eea73be29d098b803a06.zip
-fix queue length counting bug
Diffstat (limited to 'src/util')
-rw-r--r--src/util/mq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/util/mq.c b/src/util/mq.c
index 61b5471e1..3d6f27567 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -1013,7 +1013,7 @@ void
1013GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) 1013GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq)
1014{ 1014{
1015 struct GNUNET_MQ_DestroyNotificationHandle *dnh; 1015 struct GNUNET_MQ_DestroyNotificationHandle *dnh;
1016 1016
1017 if (NULL != mq->destroy_impl) 1017 if (NULL != mq->destroy_impl)
1018 { 1018 {
1019 mq->destroy_impl (mq, mq->impl_state); 1019 mq->destroy_impl (mq, mq->impl_state);
@@ -1032,6 +1032,7 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq)
1032 GNUNET_CONTAINER_DLL_remove (mq->envelope_head, 1032 GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
1033 mq->envelope_tail, 1033 mq->envelope_tail,
1034 ev); 1034 ev);
1035 GNUNET_assert (0 < mq->queue_length);
1035 mq->queue_length--; 1036 mq->queue_length--;
1036 GNUNET_MQ_discard (ev); 1037 GNUNET_MQ_discard (ev);
1037 } 1038 }
@@ -1042,6 +1043,7 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq)
1042 mq->current_envelope->parent_queue = NULL; 1043 mq->current_envelope->parent_queue = NULL;
1043 GNUNET_MQ_discard (mq->current_envelope); 1044 GNUNET_MQ_discard (mq->current_envelope);
1044 mq->current_envelope = NULL; 1045 mq->current_envelope = NULL;
1046 GNUNET_assert (0 < mq->queue_length);
1045 mq->queue_length--; 1047 mq->queue_length--;
1046 } 1048 }
1047 GNUNET_assert (0 == mq->queue_length); 1049 GNUNET_assert (0 == mq->queue_length);
@@ -1107,6 +1109,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev)
1107 { 1109 {
1108 // complex case, we already started with transmitting 1110 // complex case, we already started with transmitting
1109 // the message 1111 // the message
1112 GNUNET_assert (0 < mq->queue_length);
1110 mq->queue_length--; 1113 mq->queue_length--;
1111 mq->cancel_impl (mq, 1114 mq->cancel_impl (mq,
1112 mq->impl_state); 1115 mq->impl_state);
@@ -1121,7 +1124,6 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev)
1121 GNUNET_CONTAINER_DLL_remove (mq->envelope_head, 1124 GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
1122 mq->envelope_tail, 1125 mq->envelope_tail,
1123 mq->current_envelope); 1126 mq->current_envelope);
1124 mq->queue_length--;
1125 mq->send_impl (mq, 1127 mq->send_impl (mq,
1126 mq->current_envelope->mh, 1128 mq->current_envelope->mh,
1127 mq->impl_state); 1129 mq->impl_state);
@@ -1133,6 +1135,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev)
1133 GNUNET_CONTAINER_DLL_remove (mq->envelope_head, 1135 GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
1134 mq->envelope_tail, 1136 mq->envelope_tail,
1135 ev); 1137 ev);
1138 GNUNET_assert (0 < mq->queue_length);
1136 mq->queue_length--; 1139 mq->queue_length--;
1137 } 1140 }
1138 1141
@@ -1273,7 +1276,7 @@ void
1273GNUNET_MQ_destroy_notify_cancel (struct GNUNET_MQ_DestroyNotificationHandle *dnh) 1276GNUNET_MQ_destroy_notify_cancel (struct GNUNET_MQ_DestroyNotificationHandle *dnh)
1274{ 1277{
1275 struct GNUNET_MQ_Handle *mq = dnh->mq; 1278 struct GNUNET_MQ_Handle *mq = dnh->mq;
1276 1279
1277 GNUNET_CONTAINER_DLL_remove (mq->dnh_head, 1280 GNUNET_CONTAINER_DLL_remove (mq->dnh_head,
1278 mq->dnh_tail, 1281 mq->dnh_tail,
1279 dnh); 1282 dnh);