logging fixes, nicer comments
authorChristian Grothoff <christian@grothoff.org>
Sat, 18 Feb 2017 17:59:01 +0000 (18:59 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 18 Feb 2017 18:00:18 +0000 (19:00 +0100)
src/util/client.c
src/util/mq.c
src/util/mst.c

index 1cf819f9df053111b608d27ad84632ee201476c3..06f6ebc329676c47342740b9d3794b5003c86801 100644 (file)
@@ -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 */
index 265e4744baaa907b604861004d08bd996173393b..43926ed649099ecf4b76b61377caf32e8063151b 100644 (file)
@@ -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);
index 82a21b8800ac5fb24a19ee6d5502679f2d68e026..1422c248e227bc1840d1238b924ffda07f91de54 100644 (file)
@@ -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)
     {