gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34831 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r34831 - gnunet/src/rps
Date: Wed, 7 Jan 2015 15:00:15 +0100

Author: ch3
Date: 2015-01-07 15:00:15 +0100 (Wed, 07 Jan 2015)
New Revision: 34831

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
now sending push,pull to at least one peer/round

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-01-07 14:00:13 UTC (rev 34830)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-01-07 14:00:15 UTC (rev 34831)
@@ -641,6 +641,7 @@
 
   uint64_t i;
   //unsigned int *n_arr;
+  unsigned int n_peers; /* Number of peers we send pushes/pulls to */
   struct GNUNET_RPS_P2P_PushMessage        *push_msg;
   struct GNUNET_RPS_P2P_PullRequestMessage *pull_msg; // FIXME Send empty 
message
   struct GNUNET_MQ_Envelope *ev;
@@ -658,10 +659,12 @@
 
   /* Send PUSHes */
   //n_arr = GNUNET_CRYPTO_random_permute(GNUNET_CRYPTO_QUALITY_STRONG, 
(unsigned int) gossip_list_size);
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Going to send pushes to %f (%f * %u) peers.\n",
-      alpha * gossip_list_size, alpha, gossip_list_size);
-  // TODO send to at least one
-  for ( i = 0 ; i < alpha * gossip_list_size ; i++ )
+  n_peers = round (alpha * gossip_list_size);
+  if (0 == n_peers)
+    n_peers = 1;
+  LOG(GNUNET_ERROR_TYPE_DEBUG, "Going to send pushes to %u (%f * %u) peers.\n",
+      n_peers, alpha, gossip_list_size);
+  for ( i = 0 ; i < n_peers ; i++ )
   { // TODO compute length
     peer = get_rand_peer (gossip_list, gossip_list_size);
     if (own_identity != peer)
@@ -684,10 +687,12 @@
 
   /* Send PULL requests */
   //n_arr = GNUNET_CRYPTO_random_permute(GNUNET_CRYPTO_QUALITY_STRONG, 
(unsigned int) sampler_list->size);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to send pulls to %f (%f * %u) peers.\n",
-      beta * gossip_list_size, beta, gossip_list_size);
-  // TODO send to at least one
-  for ( i = 0 ; i < beta * gossip_list_size ; i++ )
+  n_peers = round (beta * gossip_list_size);
+  if (0 == n_peers)
+    n_peers = 1;
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to send pulls to %u (%f * %u) peers.\n",
+      n_peers, beta, gossip_list_size);
+  for ( i = 0 ; i < n_peers ; i++ )
   { // TODO compute length
     peer = get_rand_peer(gossip_list, gossip_list_size);
     if (own_identity != peer)




reply via email to

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