gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -simplify mq


From: gnunet
Subject: [gnunet] branch master updated: -simplify mq
Date: Mon, 25 Apr 2022 09:15:34 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 9ec614c2a -simplify mq
9ec614c2a is described below

commit 9ec614c2a79e429d0ac95e54e1abd860dd29e92b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Apr 25 09:14:32 2022 +0200

    -simplify mq
---
 contrib/gana  |  2 +-
 src/util/mq.c | 34 +++++++++++-----------------------
 2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 0958add54..f2babbbdd 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 0958add542378a6ca9c411e2dc19527834e9f645
+Subproject commit f2babbbdd477eeafb17292e16f335226ea02cb6a
diff --git a/src/util/mq.c b/src/util/mq.c
index 40ac97bbe..0d0ac3fc3 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -176,15 +176,9 @@ struct GNUNET_MQ_Handle
   unsigned int queue_length;
 
   /**
-   * #GNUNET_YES if GNUNET_MQ_impl_evacuate was called.
-   * FIXME: is this dead?
+   * True if GNUNET_MQ_impl_send_in_flight() was called.
    */
-  int evacuate_called;
-
-  /**
-   * #GNUNET_YES if GNUNET_MQ_impl_send_in_flight() was called.
-   */
-  int in_flight;
+  bool in_flight;
 };
 
 
@@ -273,7 +267,7 @@ GNUNET_MQ_handle_message (const struct 
GNUNET_MQ_MessageHandler *handlers,
       break;
     }
   }
-  done:
+done:
   if (GNUNET_NO == handled)
   {
     LOG (GNUNET_ERROR_TYPE_INFO,
@@ -336,7 +330,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *ev)
 unsigned int
 GNUNET_MQ_get_length (struct GNUNET_MQ_Handle *mq)
 {
-  if (GNUNET_YES != mq->in_flight)
+  if (! mq->in_flight)
   {
     return mq->queue_length;
   }
@@ -506,7 +500,7 @@ GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq)
 
   GNUNET_assert (0 < mq->queue_length);
   mq->queue_length--;
-  mq->in_flight = GNUNET_NO;
+  mq->in_flight = false;
   current_envelope = mq->current_envelope;
   current_envelope->parent_queue = NULL;
   mq->current_envelope = NULL;
@@ -537,7 +531,7 @@ GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq)
   struct GNUNET_MQ_Envelope *current_envelope;
   GNUNET_SCHEDULER_TaskCallback cb;
 
-  mq->in_flight = GNUNET_YES;
+  mq->in_flight = true;
   /* call is only valid if we're actually currently sending
    * a message */
   current_envelope = mq->current_envelope;
@@ -938,13 +932,11 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev)
   GNUNET_assert (NULL != mq);
   GNUNET_assert (NULL != mq->cancel_impl);
 
-  mq->evacuate_called = GNUNET_NO;
-
   if (mq->current_envelope == ev)
   {
     /* complex case, we already started with transmitting
        the message using the callbacks. */
-    GNUNET_assert (GNUNET_NO == mq->in_flight);
+    GNUNET_assert (! mq->in_flight);
     GNUNET_assert (0 < mq->queue_length);
     mq->queue_length--;
     mq->cancel_impl (mq,
@@ -974,14 +966,10 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev)
     GNUNET_assert (0 < mq->queue_length);
     mq->queue_length--;
   }
-
-  if (GNUNET_YES != mq->evacuate_called)
-  {
-    ev->parent_queue = NULL;
-    ev->mh = NULL;
-    /* also frees ev */
-    GNUNET_free (ev);
-  }
+  ev->parent_queue = NULL;
+  ev->mh = NULL;
+  /* also frees ev */
+  GNUNET_free (ev);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]