gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (0af32e036 -> 2beedf90f)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (0af32e036 -> 2beedf90f)
Date: Sat, 18 Feb 2017 19:00:21 +0100

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

grothoff pushed a change to branch master
in repository gnunet.

    from 0af32e036 loglevel MESSAGE for the incoming connection message + type
     new 6fa8e1c65 logging fixes, nicer comments
     new 2beedf90f append to TAIL of mutation list for processing in right order

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/set/gnunet-service-set.c  | 41 +++++++++++++++++++--------
 src/set/set_api.c             |  3 +-
 src/set/test_set_union_copy.c | 65 ++++++++++++++++++++++++++++++-------------
 src/util/client.c             |  2 +-
 src/util/mq.c                 | 17 +++++------
 src/util/mst.c                |  8 +++---
 6 files changed, 89 insertions(+), 47 deletions(-)

diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 5633561ac..a545e8a06 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -805,16 +805,16 @@ execute_add (struct Set *set,
   el.data = &msg[1];
   el.element_type = ntohs (msg->element_type);
   GNUNET_SET_element_hash (&el, &hash);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Client inserts element %s of size %u\n",
-              GNUNET_h2s (&hash),
-              el.size);
 
   ee = GNUNET_CONTAINER_multihashmap_get (set->content->elements,
                                           &hash);
 
   if (NULL == ee)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client inserts element %s of size %u\n",
+                GNUNET_h2s (&hash),
+                el.size);
     ee = GNUNET_malloc (el.size + sizeof *ee);
     ee->element.size = el.size;
     GNUNET_memcpy (&ee[1],
@@ -834,6 +834,11 @@ execute_add (struct Set *set,
   }
   else if (GNUNET_YES == _GSS_is_element_of_set (ee, set))
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client inserted element %s of size %u twice (ignored)\n",
+                GNUNET_h2s (&hash),
+                el.size);
+
     /* same element inserted twice */
     return;
   }
@@ -843,7 +848,9 @@ execute_add (struct Set *set,
       .generation = set->current_generation,
       .added = GNUNET_YES
     };
-    GNUNET_array_append (ee->mutations, ee->mutations_size, mut);
+    GNUNET_array_append (ee->mutations,
+                         ee->mutations_size,
+                         mut);
   }
 
   set->vt->add (set->state, ee);
@@ -863,9 +870,6 @@ execute_remove (struct Set *set,
 
   msg = (const struct GNUNET_SET_ElementMessage *) m;
   el.size = ntohs (m->size) - sizeof *msg;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Client removes element of size %u\n",
-              el.size);
   el.data = &msg[1];
   el.element_type = ntohs (msg->element_type);
   GNUNET_SET_element_hash (&el, &hash);
@@ -874,11 +878,17 @@ execute_remove (struct Set *set,
   if (NULL == ee)
   {
     /* Client tried to remove non-existing element. */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client removes non-existing element of size %u\n",
+                el.size);
     return;
   }
   if (GNUNET_NO == _GSS_is_element_of_set (ee, set))
   {
     /* Client tried to remove element twice */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client removed element of size %u twice (ignored)\n",
+                el.size);
     return;
   }
   else
@@ -887,7 +897,14 @@ execute_remove (struct Set *set,
       .generation = set->current_generation,
       .added = GNUNET_NO
     };
-    GNUNET_array_append (ee->mutations, ee->mutations_size, mut);
+
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client removes element of size %u\n",
+                el.size);
+
+    GNUNET_array_append (ee->mutations,
+                         ee->mutations_size,
+                         mut);
   }
   set->vt->remove (set->state, ee);
 }
@@ -1505,9 +1522,9 @@ handle_client_mutation (void *cls,
     pm = GNUNET_new (struct PendingMutation);
     pm->mutation_message = GNUNET_copy_message (m);
     pm->set = set;
-    GNUNET_CONTAINER_DLL_insert (set->content->pending_mutations_head,
-                                 set->content->pending_mutations_tail,
-                                 pm);
+    GNUNET_CONTAINER_DLL_insert_tail (set->content->pending_mutations_head,
+                                      set->content->pending_mutations_tail,
+                                      pm);
     return;
   }
   execute_mutation (set, m);
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 90dd708df..769be82d2 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -660,7 +660,8 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
       cont (cont_cls);
     return GNUNET_SYSERR;
   }
-  mqm = GNUNET_MQ_msg_extra (msg, element->size,
+  mqm = GNUNET_MQ_msg_extra (msg,
+                             element->size,
                              GNUNET_MESSAGE_TYPE_SET_ADD);
   msg->element_type = htons (element->element_type);
   GNUNET_memcpy (&msg[1],
diff --git a/src/set/test_set_union_copy.c b/src/set/test_set_union_copy.c
index 83a5862dd..c887a8958 100644
--- a/src/set/test_set_union_copy.c
+++ b/src/set/test_set_union_copy.c
@@ -115,7 +115,8 @@ check_count_iter (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Expected count (what: %s) to be %u, but it's actually %u\n",
                   ci_cls->what,
-                  ci_cls->expected_count, ci_cls->ongoing_count);
+                  ci_cls->expected_count,
+                  ci_cls->ongoing_count);
       ret = 1;
       GNUNET_SCHEDULER_shutdown ();
       return GNUNET_NO;
@@ -123,8 +124,13 @@ check_count_iter (void *cls,
     ci_cls->cont (ci_cls->cont_cls);
     return GNUNET_NO;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Set `%s' has element %.*s\n",
+              ci_cls->what,
+              (int) element->size,
+              (const char *) element->data);
 
-  ci_cls->ongoing_count += 1;
+  ci_cls->ongoing_count++;
   return GNUNET_YES;
 }
 
@@ -138,6 +144,10 @@ check_count (struct GNUNET_SET_Handle *set,
 {
   struct CountIterClosure *ci_cls = GNUNET_new (struct CountIterClosure);
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Checking count of %s\n",
+              what);
+
   ci_cls->expected_count = expected_count;
   ci_cls->ongoing_count = 0;
   ci_cls->cont = cont;
@@ -163,7 +173,7 @@ check_new_set_count (void *cls)
 {
   check_count (set2,
                "new set",
-               4,
+               3,
                &test_done,
                NULL);
 }
@@ -173,15 +183,23 @@ static void
 copy_done (void *cls,
            struct GNUNET_SET_Handle *new_set)
 {
-  printf ("copy done\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "copy done\n");
   set2 = new_set;
-  remove_element_str (set2, "spam");
-  add_element_str (set2, "new1");
-  add_element_str (set2, "new2");
-  remove_element_str (set2, "new2");
-  remove_element_str (set2, "new3");
+  remove_element_str (set2,
+                      "k5555");
+  add_element_str (set2,
+                   "n66666");
+  add_element_str (set2,
+                   "new2butremoved");
+  remove_element_str (set2,
+                      "new2butremoved");
+  remove_element_str (set2,
+                      "new3justremoved");
   // Check that set1 didn't change.
-  check_count (set1, "old set", 3,
+  check_count (set1,
+               "old set",
+               3,
                &check_new_set_count,
                NULL);
 }
@@ -190,7 +208,8 @@ copy_done (void *cls,
 static void
 test_copy (void *cls)
 {
-  printf ("about to copy\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "about to copy\n");
   GNUNET_SET_copy_lazy (set1,
                         &copy_done,
                         NULL);
@@ -246,17 +265,25 @@ run (void *cls,
                                     &local_id);
 
   set1 = GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_UNION);
-  add_element_str (set1, "foo");
-  add_element_str (set1, "bar");
+  add_element_str (set1,
+                   "333");
+  add_element_str (set1,
+                   "k444");
   /* duplicate -- ignored */
-  add_element_str (set1, "bar");
-  remove_element_str (set1, "foo");
+  add_element_str (set1,
+                   "k444");
+  remove_element_str (set1,
+                      "333");
   /* non-existent -- ignored */
-  remove_element_str (set1, "nonexist1");
-  add_element_str (set1, "spam");
+  remove_element_str (set1,
+                      "999999999");
+  add_element_str (set1,
+                   "k5555");
   /* duplicate -- ignored */
-  remove_element_str (set1, "foo");
-  add_element_str (set1, "eggs");
+  remove_element_str (set1,
+                      "333");
+  add_element_str (set1,
+                   "k2");
 
   check_count (set1,
                "initial test",
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)
     {

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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