From: Julius Bünger Date: Wed, 7 Jan 2015 14:00:15 +0000 (+0000) Subject: now sending push,pull to at least one peer/round X-Git-Tag: initial-import-from-subversion-38251~2721 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=22621780b74a570bf160e067b14239602750ee3a;p=oweals%2Fgnunet.git now sending push,pull to at least one peer/round --- diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index e1af57391..9f4c767e4 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -641,6 +641,7 @@ do_round(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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 @@ do_round(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* 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 @@ do_round(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* 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)