GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq)
{
struct GNUNET_MQ_DestroyNotificationHandle *dnh;
-
+
if (NULL != mq->destroy_impl)
{
mq->destroy_impl (mq, mq->impl_state);
GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
mq->envelope_tail,
ev);
+ GNUNET_assert (0 < mq->queue_length);
mq->queue_length--;
GNUNET_MQ_discard (ev);
}
mq->current_envelope->parent_queue = NULL;
GNUNET_MQ_discard (mq->current_envelope);
mq->current_envelope = NULL;
+ GNUNET_assert (0 < mq->queue_length);
mq->queue_length--;
}
GNUNET_assert (0 == mq->queue_length);
while (NULL != (dnh = mq->dnh_head))
+ {
dnh->cb (dnh->cb_cls);
+ GNUNET_MQ_destroy_notify_cancel (dnh);
+ }
if (NULL != mq->assoc_map)
{
GNUNET_CONTAINER_multihashmap32_destroy (mq->assoc_map);
{
// complex case, we already started with transmitting
// the message
+ GNUNET_assert (0 < mq->queue_length);
mq->queue_length--;
mq->cancel_impl (mq,
mq->impl_state);
GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
mq->envelope_tail,
mq->current_envelope);
- mq->queue_length--;
mq->send_impl (mq,
mq->current_envelope->mh,
mq->impl_state);
GNUNET_CONTAINER_DLL_remove (mq->envelope_head,
mq->envelope_tail,
ev);
+ GNUNET_assert (0 < mq->queue_length);
mq->queue_length--;
}
GNUNET_MQ_destroy_notify_cancel (struct GNUNET_MQ_DestroyNotificationHandle *dnh)
{
struct GNUNET_MQ_Handle *mq = dnh->mq;
-
+
GNUNET_CONTAINER_DLL_remove (mq->dnh_head,
mq->dnh_tail,
dnh);