gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (68bcee90f -> 5cc6c03b5)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (68bcee90f -> 5cc6c03b5)
Date: Wed, 29 Aug 2018 15:43:44 +0200

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

julius-buenger pushed a change to branch master
in repository gnunet.

    from 68bcee90f Add missing #ifdef
     new 584efed1e Update the view size on a new network size estimate
     new dc24eb644 Get statistics values from within sampler
     new 1a831d151 Add reason to wait for more peers
     new 05eac20b9 Schedule insertion in view,sampler on check
     new 970e25512 Fix condition for returning peer from sampler element
     new 5cc6c03b5 Make cosmetic changes

The 6 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/rps/gnunet-service-rps.c         | 11 +++++-----
 src/rps/gnunet-service-rps_sampler.c | 41 +++++++++++++++++++++++++++---------
 src/rps/rps.h                        |  7 +++++-
 3 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 5ed35e538..98e57a38e 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -61,7 +61,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
 /**
  * Handle to the statistics service.
  */
-static struct GNUNET_STATISTICS_Handle *stats;
+struct GNUNET_STATISTICS_Handle *stats;
 
 /**
  * Our own identity.
@@ -1418,23 +1418,23 @@ check_peer_flag (const struct GNUNET_PeerIdentity *peer,
  * If not known yet, insert into known peers
  *
  * @param peer the peer whose liveliness is to be checked
- * @return #GNUNET_YES if peer had to be inserted
+ * @return #GNUNET_YES if the check was issued
  *         #GNUNET_NO  otherwise
  */
 static int
 issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer)
 {
   struct PeerContext *peer_ctx;
-  int ret;
 
-  ret = insert_peer (peer);
+  (void) insert_peer (peer);
   peer_ctx = get_peer_ctx (peer);
   if ( (GNUNET_NO == check_peer_flag (peer, Peers_ONLINE)) &&
        (NULL == peer_ctx->liveliness_check_pending) )
   {
     check_peer_live (peer_ctx);
+    return GNUNET_YES;
   }
-  return ret;
+  return GNUNET_NO;
 }
 
 
@@ -2656,6 +2656,7 @@ nse_callback (void *cls,
   /* If the NSE has changed adapt the lists accordingly */
   resize_wrapper (prot_sampler, sampler_size_est_need);
   client_resize_wrapper ();
+  View_change_len (view_size_est_need);
 }
 
 
diff --git a/src/rps/gnunet-service-rps_sampler.c 
b/src/rps/gnunet-service-rps_sampler.c
index 20b2d3420..fdd500aa1 100644
--- a/src/rps/gnunet-service-rps_sampler.c
+++ b/src/rps/gnunet-service-rps_sampler.c
@@ -23,6 +23,7 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_statistics_service.h"
 #include "rps.h"
 
 #include "gnunet-service-rps_sampler.h"
@@ -483,12 +484,11 @@ RPS_sampler_update (struct RPS_Sampler *sampler,
            "Got %s",
            GNUNET_i2s_full (id));
 
-  for (i = 0 ; i < sampler->sampler_size ; i++)
+  for (i = 0; i < sampler->sampler_size; i++)
   {
     RPS_sampler_elem_next (sampler->sampler_elements[i],
                            id);
   }
-
 }
 
 
@@ -633,11 +633,31 @@ sampler_mod_get_rand_peer (void *cls)
                                       cls);
       return;
     }
-    // TODO add other reasons to wait here
   }
+  if (2 > s_elem->num_peers)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+        "This s_elem saw less than two peers -- scheduling for later\n");
+    GNUNET_assert (NULL == gpc->get_peer_task);
+    gpc->get_peer_task =
+      GNUNET_SCHEDULER_add_delayed (sampler->max_round_interval,
+                                    &sampler_mod_get_rand_peer,
+                                    cls);
+    return;
+  }
+  /* More reasons to wait could be added here */
+
+  GNUNET_STATISTICS_set (stats,
+                         "# client sampler element input",
+                         s_elem->num_peers,
+                         GNUNET_NO);
+  GNUNET_STATISTICS_set (stats,
+                         "# client sampler element change",
+                         s_elem->num_change,
+                         GNUNET_NO);
 
-  s_elem->last_client_request = GNUNET_TIME_absolute_get ();
   RPS_sampler_elem_reinit (s_elem);
+  s_elem->last_client_request = GNUNET_TIME_absolute_get ();
 
   GNUNET_CONTAINER_DLL_remove (gpc->req_handle->gpc_head,
                                gpc->req_handle->gpc_tail,
@@ -664,17 +684,18 @@ sampler_mod_get_rand_peer (void *cls)
 struct RPS_SamplerRequestHandle *
 RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler,
                               RPS_sampler_n_rand_peers_ready_cb cb,
-                              void *cls, uint32_t num_peers)
+                              void *cls,
+                              uint32_t num_peers)
 {
+  uint32_t i;
+  struct RPS_SamplerRequestHandle *req_handle;
+  struct GetPeerCls *gpc;
+
   GNUNET_assert (0 != sampler->sampler_size);
   if (0 == num_peers)
     return NULL;
 
   // TODO check if we have too much (distinct) sampled peers
-  uint32_t i;
-  struct RPS_SamplerRequestHandle *req_handle;
-  struct GetPeerCls *gpc;
-
   req_handle = GNUNET_new (struct RPS_SamplerRequestHandle);
   req_handle->num_peers = num_peers;
   req_handle->cur_num_peers = 0;
@@ -689,7 +710,7 @@ RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
       "Scheduling requests for %" PRIu32 " peers\n", num_peers);
 
-  for (i = 0 ; i < num_peers ; i++)
+  for (i = 0; i < num_peers; i++)
   {
     gpc = GNUNET_new (struct GetPeerCls);
     gpc->req_handle = req_handle;
diff --git a/src/rps/rps.h b/src/rps/rps.h
index 6bf2273b4..58ba79082 100644
--- a/src/rps/rps.h
+++ b/src/rps/rps.h
@@ -216,6 +216,7 @@ struct GNUNET_RPS_CS_DEBUG_ViewReply
 };
   /* Followed by num_peers * GNUNET_PeerIdentity */
 
+GNUNET_NETWORK_STRUCT_END
 
 /***********************************************************************
  * Defines from old gnunet-service-rps_peers.h
@@ -312,4 +313,8 @@ typedef int
                   const struct GNUNET_PeerIdentity *peer);
 
 
-GNUNET_NETWORK_STRUCT_END
+/**
+ * Handle to the statistics service.
+ */
+extern struct GNUNET_STATISTICS_Handle *stats;
+

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



reply via email to

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