GNUNET_assert (NULL == mq->envelope_head);
mq->current_envelope = ev;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mq: sending message of type %u, queue empty (MQ: %p)\n",
- ntohs(ev->mh->type),
- mq);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "sending message of type %u, queue empty (MQ: %p)\n",
+ ntohs(ev->mh->type),
+ mq);
mq->send_impl (mq,
ev->mh,
mq->envelope_tail,
mq->current_envelope);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mq: sending message of type %u from queue\n",
- ntohs(mq->current_envelope->mh->type));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "sending message of type %u from queue\n",
+ ntohs(mq->current_envelope->mh->type));
mq->send_impl (mq,
mq->current_envelope->mh,
GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq,
void *handlers_cls)
{
- unsigned int i;
-
if (NULL == mq->handlers)
return;
- for (i=0;NULL != mq->handlers[i].cb; i++)
+ for (unsigned int i=0;NULL != mq->handlers[i].cb; i++)
mq->handlers[i].cls = handlers_cls;
}
GNUNET_SCHEDULER_TaskCallback cb,
void *cb_cls)
{
- GNUNET_assert (NULL == ev->sent_cb);
+ /* allow setting *OR* clearing callback */
+ GNUNET_assert ( (NULL == ev->sent_cb) ||
+ (NULL == cb) );
ev->sent_cb = cb;
ev->sent_cls = cb_cls;
}
ev);
GNUNET_assert (0 < mq->queue_length);
mq->queue_length--;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MQ destroy drops message of type %u\n",
- ntohs (ev->mh->type));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "MQ destroy drops message of type %u\n",
+ ntohs (ev->mh->type));
GNUNET_MQ_discard (ev);
}
if (NULL != mq->current_envelope)
/* we can only discard envelopes that
* are not queued! */
mq->current_envelope->parent_queue = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MQ destroy drops current message of type %u\n",
- ntohs (mq->current_envelope->mh->type));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "MQ destroy drops current message of type %u\n",
+ ntohs (mq->current_envelope->mh->type));
GNUNET_MQ_discard (mq->current_envelope);
mq->current_envelope = NULL;
GNUNET_assert (0 < mq->queue_length);
mq->envelope_tail,
mq->current_envelope);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "mq: sending canceled message of type %u queue\n",
- ntohs(ev->mh->type));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "sending canceled message of type %u queue\n",
+ ntohs(ev->mh->type));
mq->send_impl (mq,
mq->current_envelope->mh,