gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: fix logging, immediately sw


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: fix logging, immediately switch to full set transmission if other peer has 0 elements
Date: Sat, 11 Mar 2017 18:33:16 +0100

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 538d7fde8 fix logging, immediately switch to full set transmission if 
other peer has 0 elements
538d7fde8 is described below

commit 538d7fde8cb1c0d079f01f2290aa3e3e2744beff
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Mar 11 18:33:09 2017 +0100

    fix logging, immediately switch to full set transmission if other peer has 
0 elements
---
 src/revocation/test_revocation.c   | 20 +++++++++----------
 src/set/gnunet-service-set_union.c | 39 +++++++++++++++++++++++++++-----------
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
index d3bbb879a..8d5593694 100644
--- a/src/revocation/test_revocation.c
+++ b/src/revocation/test_revocation.c
@@ -104,8 +104,8 @@ revocation_remote_cb (void *cls,
 
   if (GNUNET_NO == is_valid)
   {
-    fprintf (stderr,
-             "Local revocation successful\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Local revocation successful\n");
     ok = 0;
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -118,8 +118,8 @@ revocation_remote_cb (void *cls,
                                   NULL);
     return;
   }
-  fprintf (stderr,
-           "Flooding of revocation failed\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Flooding of revocation failed\n");
   ok = 2;
   GNUNET_SCHEDULER_shutdown ();
 }
@@ -141,8 +141,8 @@ revocation_cb (void *cls,
   testpeers[1].revok_handle = NULL;
   if (GNUNET_NO == is_valid)
   {
-    fprintf (stderr,
-             "Revocation successful\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Revocation successful\n");
     check_revocation (NULL);
   }
 }
@@ -386,8 +386,8 @@ test_connection (void *cls,
    /* We are generating a CLIQUE */
   if (NUM_TEST_PEERS * (NUM_TEST_PEERS -1) == links_succeeded)
   {
-    fprintf (stderr,
-             "Testbed connected peers, initializing test\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Testbed connected peers, initializing test\n");
     for (c = 0; c < num_peers; c++)
     {
       testpeers[c].p = peers[c];
@@ -403,8 +403,8 @@ test_connection (void *cls,
   }
   else
   {
-    fprintf (stderr,
-             "Testbed failed to connect peers\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Testbed failed to connect peers\n");
     ok = 5;
     GNUNET_SCHEDULER_shutdown ();
     return;
diff --git a/src/set/gnunet-service-set_union.c 
b/src/set/gnunet-service-set_union.c
index 200bd4b8e..1ff3d7716 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -787,11 +787,18 @@ send_element_iterator (void *cls,
   struct GNUNET_SET_Element *el = &ee->element;
   struct GNUNET_MQ_Envelope *ev;
 
-
-  ev = GNUNET_MQ_msg_extra (emsg, el->size, 
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT);
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "Sending element %s\n",
+       GNUNET_h2s (key));
+  ev = GNUNET_MQ_msg_extra (emsg,
+                            el->size,
+                            GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT);
   emsg->element_type = htons (el->element_type);
-  GNUNET_memcpy (&emsg[1], el->data, el->size);
-  GNUNET_MQ_send (op->mq, ev);
+  GNUNET_memcpy (&emsg[1],
+                 el->data,
+                 el->size);
+  GNUNET_MQ_send (op->mq,
+                  ev);
   return GNUNET_YES;
 }
 
@@ -802,11 +809,14 @@ send_full_set (struct Operation *op)
   struct GNUNET_MQ_Envelope *ev;
 
   op->state->phase = PHASE_FULL_SENDING;
-
+  /* FIXME: use a more memory-friendly way of doing this with an
+     iterator, just as we do in the non-full case! */
   (void) GNUNET_CONTAINER_multihashmap_iterate 
(op->spec->set->content->elements,
-                                                &send_element_iterator, op);
+                                                &send_element_iterator,
+                                                op);
   ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE);
-  GNUNET_MQ_send (op->mq, ev);
+  GNUNET_MQ_send (op->mq,
+                  ev);
 }
 
 
@@ -922,17 +932,19 @@ handle_union_p2p_strata_estimator (void *cls,
   }
 
   if ( (GNUNET_YES == op->spec->force_full) ||
-       (diff > op->state->initial_size / 4))
+       (diff > op->state->initial_size / 4) ||
+       (0 == other_size) )
   {
     LOG (GNUNET_ERROR_TYPE_INFO,
-         "Sending full set (diff=%d, own set=%u)\n",
+         "Deciding to go for full set transmission (diff=%d, own set=%u)\n",
          diff,
          op->state->initial_size);
     GNUNET_STATISTICS_update (_GSS_statistics,
                               "# of full sends",
                               1,
                               GNUNET_NO);
-    if (op->state->initial_size <= other_size)
+    if ( (op->state->initial_size <= other_size) ||
+         (0 == other_size) )
     {
       send_full_set (op);
     }
@@ -940,9 +952,12 @@ handle_union_p2p_strata_estimator (void *cls,
     {
       struct GNUNET_MQ_Envelope *ev;
 
+      LOG (GNUNET_ERROR_TYPE_INFO,
+           "Telling other peer that we expect its full set\n");
       op->state->phase = PHASE_EXPECT_IBF;
       ev = GNUNET_MQ_msg_header 
(GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL);
-      GNUNET_MQ_send (op->mq, ev);
+      GNUNET_MQ_send (op->mq,
+                      ev);
     }
   }
   else
@@ -1773,6 +1788,8 @@ handle_union_p2p_request_full (void *cls,
 {
   struct Operation *op = cls;
 
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "Received request for full set transmission\n");
   if (OT_UNION != op->type)
   {
     GNUNET_break_op (0);

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



reply via email to

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