From 6fa8e1c652f447ebd94e144314ce55412dab80c8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 18 Feb 2017 18:59:01 +0100 Subject: [PATCH] logging fixes, nicer comments --- src/util/client.c | 2 +- src/util/mq.c | 17 +++++++---------- src/util/mst.c | 8 ++++---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/util/client.c b/src/util/client.c index 1cf819f9d..06f6ebc32 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -879,4 +879,4 @@ GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, return cstate->mq; } -/* end of client_new.c */ +/* end of client.c */ diff --git a/src/util/mq.c b/src/util/mq.c index 265e4744b..43926ed64 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -368,6 +368,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, ev); return; } + GNUNET_assert (NULL == mq->envelope_head); mq->current_envelope = ev; mq->send_impl (mq, ev->mh, @@ -960,20 +961,16 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) if (mq->current_envelope == ev) { - // complex case, we already started with transmitting - // the message + /* complex case, we already started with transmitting + the message using the callbacks. */ GNUNET_assert (0 < mq->queue_length); mq->queue_length--; mq->cancel_impl (mq, mq->impl_state); - // continue sending the next message, if any - if (NULL == mq->envelope_head) + /* continue sending the next message, if any */ + mq->current_envelope = mq->envelope_head; + if (NULL != mq->current_envelope) { - mq->current_envelope = NULL; - } - else - { - mq->current_envelope = mq->envelope_head; GNUNET_CONTAINER_DLL_remove (mq->envelope_head, mq->envelope_tail, mq->current_envelope); @@ -984,7 +981,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) } else { - // simple case, message is still waiting in the queue + /* simple case, message is still waiting in the queue */ GNUNET_CONTAINER_DLL_remove (mq->envelope_head, mq->envelope_tail, ev); diff --git a/src/util/mst.c b/src/util/mst.c index 82a21b880..1422c248e 100644 --- a/src/util/mst.c +++ b/src/util/mst.c @@ -130,7 +130,7 @@ GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst, GNUNET_assert (mst->off <= mst->pos); GNUNET_assert (mst->pos <= mst->curr_buf); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Server-mst receives %u bytes with %u bytes already in private buffer\n", + "MST receives %u bytes with %u bytes already in private buffer\n", (unsigned int) size, (unsigned int) (mst->pos - mst->off)); ret = GNUNET_OK; @@ -151,7 +151,7 @@ do_align: } if (mst->pos - mst->off < sizeof (struct GNUNET_MessageHeader)) { - delta + delta = GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - (mst->pos - mst->off), size); @@ -229,8 +229,8 @@ do_align: if (one_shot == GNUNET_YES) one_shot = GNUNET_SYSERR; mst->off += want; - if (GNUNET_SYSERR == mst->cb (mst->cb_cls, - hdr)) + if (GNUNET_SYSERR == mst->cb (mst->cb_cls, + hdr)) return GNUNET_SYSERR; if (mst->off == mst->pos) { -- 2.25.1