summaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-31 13:03:48 +0100
committerChristian Grothoff <christian@grothoff.org>2019-10-31 13:03:48 +0100
commit7e3cf5f461eb4fbb7581672bf0835da07c378136 (patch)
treebdc3874b7894242b095b892f1ed3e81a4d4f06c0 /src/rps
parent01b480d6d026e0c537dc284a7e7df2c0320a3528 (diff)
tighten formatting rules
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-rps-profiler.c122
-rw-r--r--src/rps/gnunet-rps.c3
-rw-r--r--src/rps/gnunet-service-rps.c36
-rw-r--r--src/rps/gnunet-service-rps_custommap.c10
-rw-r--r--src/rps/gnunet-service-rps_sampler.c1
-rw-r--r--src/rps/gnunet-service-rps_sampler_elem.c2
-rw-r--r--src/rps/gnunet-service-rps_view.c1
-rw-r--r--src/rps/rps-sampler_common.c2
-rw-r--r--src/rps/rps-test_util.c16
-rw-r--r--src/rps/rps.h1
-rw-r--r--src/rps/rps_api.c6
-rw-r--r--src/rps/test_rps.c157
-rw-r--r--src/rps/test_rps_api.c1
-rw-r--r--src/rps/test_service_rps_custommap.c1
-rw-r--r--src/rps/test_service_rps_sampler_elem.c1
-rw-r--r--src/rps/test_service_rps_view.c1
16 files changed, 255 insertions, 106 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 03b96f264..af43a0fa1 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -160,7 +160,8 @@ struct STATcls
*
* @return corresponding enum
*/
-enum STAT_TYPE stat_str_2_type (const char *stat_str)
+enum STAT_TYPE
+stat_str_2_type (const char *stat_str)
{
if (0 == strncmp (stat_type_strings[STAT_TYPE_BLOCKS_NO_PULL],
stat_str,
@@ -890,9 +891,7 @@ tofile_ (const char *file_name, const char *line)
"Failed to write string to buffer (size: %i)\n",
size);
return;
- } */
-
- size = strlen (line) * sizeof(char);
+ } */size = strlen (line) * sizeof(char);
size2 = GNUNET_DISK_file_write (f, line, size);
if (size != size2)
@@ -916,6 +915,7 @@ tofile_ (const char *file_name, const char *line)
}
}
+
/**
* This function is used to facilitate writing important information to disk
*/
@@ -1000,7 +1000,8 @@ make_oplist_entry ()
* @return #GNUNET_YES if so
* #GNUNET_NO otherwise
*/
-static int check_statistics_collect_completed_single_peer (
+static int
+check_statistics_collect_completed_single_peer (
const struct RPSPeer *rps_peer)
{
if (cur_test_run.stat_collect_flags !=
@@ -1011,6 +1012,8 @@ static int check_statistics_collect_completed_single_peer (
}
return GNUNET_YES;
}
+
+
/**
* @brief Checks if all peers already received their statistics value from the
* statistics service.
@@ -1018,7 +1021,8 @@ static int check_statistics_collect_completed_single_peer (
* @return #GNUNET_YES if so
* #GNUNET_NO otherwise
*/
-static int check_statistics_collect_completed ()
+static int
+check_statistics_collect_completed ()
{
uint32_t i;
@@ -1039,6 +1043,7 @@ static int check_statistics_collect_completed ()
return GNUNET_YES;
}
+
static void
rps_disconnect_adapter (void *cls,
void *op_result);
@@ -1059,6 +1064,7 @@ cancel_pending_req (struct PendingRequest *pending_req)
GNUNET_free (pending_req);
}
+
static void
cancel_request (struct PendingReply *pending_rep)
{
@@ -1078,6 +1084,7 @@ cancel_request (struct PendingReply *pending_rep)
pending_rep = NULL;
}
+
void
clean_peer (unsigned peer_index)
{
@@ -1111,6 +1118,7 @@ clean_peer (unsigned peer_index)
}
}
+
/**
* Task run on timeout to shut everything down.
*/
@@ -1158,6 +1166,7 @@ shutdown_op (void *cls)
close_all_files ();
}
+
static void
trigger_shutdown (void *cls)
{
@@ -1209,7 +1218,7 @@ post_test_op (void *cls)
}
}
/* If we do not collect statistics, shut down directly */
- if ((NO_COLLECT_STATISTICS == cur_test_run.have_collect_statistics)||
+ if ((NO_COLLECT_STATISTICS == cur_test_run.have_collect_statistics) ||
(GNUNET_YES == check_statistics_collect_completed ()) )
{
GNUNET_SCHEDULER_cancel (shutdown_task);
@@ -1255,12 +1264,12 @@ info_cb (void *cb_cls,
(void) op;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
- if ((NULL == pinfo)||(NULL != emsg))
+ if ((NULL == pinfo) || (NULL != emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg);
GNUNET_TESTBED_operation_done (entry->op);
@@ -1309,7 +1318,7 @@ rps_connect_complete_cb (void *cls,
struct RPSPeer *rps_peer = cls;
struct GNUNET_RPS_Handle *rps = ca_result;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1361,6 +1370,7 @@ rps_connect_adapter (void *cls,
return h;
}
+
/**
* Called to open a connection to the peer's statistics
*
@@ -1380,6 +1390,7 @@ stat_connect_adapter (void *cls,
return peer->stats_h;
}
+
/**
* Called to disconnect from peer's statistics service
*
@@ -1401,6 +1412,7 @@ stat_disconnect_adapter (void *cls, void *op_result)
peer->stats_h = NULL;
}
+
/**
* Called after successfully opening a connection to a peer's statistics
* service; we register statistics monitoring for CORE and NSE here.
@@ -1551,7 +1563,7 @@ request_peers (void *cls)
rps_peer->pending_req_tail,
pending_req);
rps_peer->num_pending_reqs--;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting one peer\n");
@@ -1604,6 +1616,7 @@ schedule_missing_requests (struct RPSPeer *rps_peer)
}
}
+
void
cancel_pending_req_rep (struct RPSPeer *rps_peer)
{
@@ -1617,6 +1630,7 @@ cancel_pending_req_rep (struct RPSPeer *rps_peer)
GNUNET_assert (0 == rps_peer->num_pending_reps);
}
+
/***********************************
* MALICIOUS
***********************************/
@@ -1624,7 +1638,8 @@ cancel_pending_req_rep (struct RPSPeer *rps_peer)
/**
* Initialise only non-mal RPSPeers
*/
-static void mal_init_peer (struct RPSPeer *rps_peer)
+static void
+mal_init_peer (struct RPSPeer *rps_peer)
{
if (rps_peer->index >= round (portion * num_peers))
rps_peer->num_ids_to_request = 1;
@@ -1664,12 +1679,13 @@ mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
#endif /* ENABLE_MALICIOUS */
}
+
static void
mal_cb (struct RPSPeer *rps_peer)
{
uint32_t num_mal_peers;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1690,6 +1706,7 @@ mal_cb (struct RPSPeer *rps_peer)
#endif /* ENABLE_MALICIOUS */
}
+
/***********************************
* CHURN
***********************************/
@@ -1711,13 +1728,13 @@ churn (void *cls);
static void
churn_test_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
/* Start churn */
- if ((HAVE_CHURN == cur_test_run.have_churn)&&(NULL == churn_task))
+ if ((HAVE_CHURN == cur_test_run.have_churn) && (NULL == churn_task))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting churn task\n");
@@ -1735,6 +1752,7 @@ churn_test_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
/***********************************
* PROFILER
***********************************/
@@ -1756,7 +1774,7 @@ churn_cb (void *cls,
(void) op;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1828,6 +1846,7 @@ churn_cb (void *cls,
// run_round ();
}
+
/**
* @brief Set the rps-service up or down for a specific peer
*
@@ -1895,7 +1914,7 @@ churn (void *cls)
(void) cls;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1956,7 +1975,8 @@ churn (void *cls)
/**
* Initialise given RPSPeer
*/
-static void profiler_init_peer (struct RPSPeer *rps_peer)
+static void
+profiler_init_peer (struct RPSPeer *rps_peer)
{
rps_peer->num_ids_to_request = cur_test_run.num_requests;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer shall request %i peers\n",
@@ -2111,13 +2131,13 @@ profiler_reply_handle_info (void *cls,
static void
profiler_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
/* Start churn */
- if ((HAVE_CHURN == cur_test_run.have_churn)&&(NULL == churn_task))
+ if ((HAVE_CHURN == cur_test_run.have_churn) && (NULL == churn_task))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting churn task\n");
@@ -2139,6 +2159,7 @@ profiler_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
/**
* Function called from #profiler_eval with a filename.
*
@@ -2175,6 +2196,7 @@ file_name_cb (void *cls, const char *filename)
return GNUNET_OK;
}
+
/**
* This is run after the test finished.
*
@@ -2202,7 +2224,8 @@ profiler_eval (void)
*
* @return
*/
-static int is_in_view (uint32_t a, uint32_t b)
+static int
+is_in_view (uint32_t a, uint32_t b)
{
uint32_t i;
@@ -2218,7 +2241,9 @@ static int is_in_view (uint32_t a, uint32_t b)
return GNUNET_NO;
}
-static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
+
+static uint32_t
+get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
{
uint32_t i;
@@ -2238,6 +2263,7 @@ static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
GNUNET_assert (0);
}
+
/**
* @brief Counts number of peers in view of a that have b in their view
*
@@ -2246,7 +2272,8 @@ static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
*
* @return
*/
-static uint32_t count_containing_views (uint32_t a, uint32_t b)
+static uint32_t
+count_containing_views (uint32_t a, uint32_t b)
{
uint32_t i;
uint32_t peer_idx;
@@ -2263,13 +2290,15 @@ static uint32_t count_containing_views (uint32_t a, uint32_t b)
return count;
}
+
/**
* @brief Computes the probability for each other peer to be selected by the
* sampling process based on the views of all peers
*
* @param peer_idx index of the peer that is about to sample
*/
-static void compute_probabilities (uint32_t peer_idx)
+static void
+compute_probabilities (uint32_t peer_idx)
{
// double probs[num_peers] = { 0 };
double probs[num_peers];
@@ -2427,6 +2456,7 @@ static void compute_probabilities (uint32_t peer_idx)
GNUNET_free (probs_as_str);
}
+
/**
* @brief This counts the number of peers in which views a given peer occurs.
*
@@ -2436,7 +2466,8 @@ static void compute_probabilities (uint32_t peer_idx)
*
* @return the number of occurrences
*/
-static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
+static uint32_t
+count_peer_in_views_2 (uint32_t peer_idx)
{
uint32_t i, j;
uint32_t count = 0;
@@ -2458,7 +2489,9 @@ static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
return count;
}
-static uint32_t cumulated_view_sizes ()
+
+static uint32_t
+cumulated_view_sizes ()
{
uint32_t i;
@@ -2470,7 +2503,9 @@ static uint32_t cumulated_view_sizes ()
return view_sizes;
}
-static void count_peer_in_views (uint32_t *count_peers)
+
+static void
+count_peer_in_views (uint32_t *count_peers)
{
uint32_t i, j;
@@ -2488,7 +2523,9 @@ static void count_peer_in_views (uint32_t *count_peers)
}
}
-void compute_diversity ()
+
+void
+compute_diversity ()
{
uint32_t i;
/* ith entry represents the numer of occurrences in other peer's views */
@@ -2531,7 +2568,9 @@ void compute_diversity ()
GNUNET_free (deviation);
}
-void print_view_sizes ()
+
+void
+print_view_sizes ()
{
uint32_t i;
@@ -2545,15 +2584,19 @@ void print_view_sizes ()
}
}
-void all_views_updated_cb ()
+
+void
+all_views_updated_cb ()
{
compute_diversity ();
print_view_sizes ();
}
-void view_update_cb (void *cls,
- uint64_t view_size,
- const struct GNUNET_PeerIdentity *peers)
+
+void
+view_update_cb (void *cls,
+ uint64_t view_size,
+ const struct GNUNET_PeerIdentity *peers)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"View was updated (%" PRIu64 ")\n", view_size);
@@ -2602,6 +2645,7 @@ void view_update_cb (void *cls,
all_views_updated_cb ();
}
+
static void
pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
{
@@ -2612,7 +2656,9 @@ pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
GNUNET_RPS_view_request (h, 0, view_update_cb, rps_peer);
}
-void write_final_stats (void)
+
+void
+write_final_stats (void)
{
uint64_t sums[STAT_TYPE_MAX] = { 0 };
@@ -2732,6 +2778,7 @@ void write_final_stats (void)
sums[STAT_TYPE_VIEW_SIZE_AIM]);
}
+
/**
* Continuation called by #GNUNET_STATISTICS_get() functions.
*
@@ -2766,7 +2813,7 @@ post_test_shutdown_ready_cb (void *cls,
return;
}
- if ((NULL != rps_peer->stat_op)&&
+ if ((NULL != rps_peer->stat_op) &&
(GNUNET_YES == check_statistics_collect_completed_single_peer (
rps_peer)) )
{
@@ -2788,6 +2835,7 @@ post_test_shutdown_ready_cb (void *cls,
}
}
+
/**
* Callback function to process statistic values.
*
@@ -2907,7 +2955,7 @@ test_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n");
/* Check whether we timed out */
- if ((n_peers != num_peers)||
+ if ((n_peers != num_peers) ||
(NULL == peers) ||
(0 == links_succeeded) )
{
@@ -3127,6 +3175,7 @@ run (void *cls,
NULL);
}
+
/**
* Entry point for the testcase, sets up the testbed.
*
@@ -3204,4 +3253,5 @@ main (int argc, char *argv[])
return ret_value;
}
+
/* end of test_rps.c */
diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c
index 6c1c96cc9..33c03f006 100644
--- a/src/rps/gnunet-rps.c
+++ b/src/rps/gnunet-rps.c
@@ -106,6 +106,7 @@ reply_handle (void *cls,
GNUNET_SCHEDULER_shutdown ();
}
+
/**
* Callback called on receipt view update.
* Prints view.
@@ -249,6 +250,7 @@ run (void *cls,
}
}
+
/**
* The main function to rps.
*
@@ -288,4 +290,5 @@ main (int argc, char *const *argv)
options, &run, NULL)) ? ret : 1;
}
+
/* end of gnunet-rps.c */
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 66ffd173a..58fbd6a18 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -85,7 +85,6 @@
#define unset_channel_flag(channel_flags, mask) ((*channel_flags) &= ~(mask))
-
/**
* Pending operation on peer consisting of callback and closure
*
@@ -623,6 +622,7 @@ get_peer_ctx (const struct GNUNET_CONTAINER_MultiPeerMap *peer_map,
return ctx;
}
+
/**
* @brief Check whether we have information about the given peer.
*
@@ -856,6 +856,7 @@ add_valid_peer (const struct GNUNET_PeerIdentity *peer,
return ret;
}
+
static void
remove_pending_message (struct PendingMessage *pending_msg, int cancel);
@@ -900,6 +901,7 @@ set_peer_online (struct PeerContext *peer_ctx)
GNUNET_array_grow (peer_ctx->pending_ops, peer_ctx->num_pending_ops, 0);
}
+
static void
cleanup_destroyed_channel (void *cls,
const struct GNUNET_CADET_Channel *channel);
@@ -1048,6 +1050,7 @@ get_mq (struct PeerContext *peer_ctx)
return peer_ctx->mq;
}
+
/**
* @brief Add an envelope to a message passed to mq to list of pending messages
*
@@ -1124,6 +1127,7 @@ mq_online_check_successful (void *cls)
}
}
+
/**
* Issue a check whether peer is online
*
@@ -1758,6 +1762,7 @@ check_peer_flag (const struct GNUNET_CONTAINER_MultiPeerMap *peer_map,
return check_peer_flag_set (peer_ctx, flags);
}
+
/**
* @brief Try connecting to a peer to see whether it is online
*
@@ -1969,6 +1974,7 @@ destroy_sending_channel (struct PeerContext *peer_ctx)
return GNUNET_NO;
}
+
/**
* @brief Send a message to another peer.
*
@@ -1999,6 +2005,7 @@ send_message (struct PeerContext *peer_ctx,
GNUNET_MQ_send (mq, ev);
}
+
/**
* @brief Schedule a operation on given peer
*
@@ -2035,6 +2042,7 @@ schedule_operation (struct PeerContext *peer_ctx,
return GNUNET_NO;
}
+
/***********************************************************************
* /Old gnunet-service-rps_peers.c
***********************************************************************/
@@ -2122,9 +2130,6 @@ struct ClientContext *cli_ctx_tail;
***********************************************************************/
-
-
-
/***********************************************************************
* Util functions
***********************************************************************/
@@ -2383,7 +2388,7 @@ clients_notify_stream_peer (const struct Sub *sub,
cli_ctx_iter = cli_ctx_iter->next)
{
if ((GNUNET_YES == cli_ctx_iter->stream_update) &&
- ((sub == cli_ctx_iter->sub) ||(sub == msub) ))
+ ((sub == cli_ctx_iter->sub) || (sub == msub) ))
{
send_stream_peers (cli_ctx_iter, num_peers, peers);
}
@@ -2828,7 +2833,7 @@ cleanup_destroyed_channel (void *cls,
channel_ctx->channel = NULL;
remove_channel_ctx (channel_ctx);
- if ((NULL != peer_ctx)&&
+ if ((NULL != peer_ctx) &&
(peer_ctx->send_channel_ctx == channel_ctx) &&
(GNUNET_YES == check_sending_channel_needed (channel_ctx->peer_ctx)) )
{
@@ -2836,12 +2841,12 @@ cleanup_destroyed_channel (void *cls,
}
}
+
/***********************************************************************
* /Util functions
***********************************************************************/
-
/***********************************************************************
* Sub
***********************************************************************/
@@ -3016,6 +3021,8 @@ write_histogram_to_file (const uint32_t hist_array[],
collect_str);
GNUNET_free (file_name_full);
}
+
+
#endif /* TO_FILE */
@@ -3148,6 +3155,7 @@ core_disconnects (void *cls,
GNUNET_CONTAINER_multipeermap_remove_all (map_single_hop, peer);
}
+
/***********************************************************************
* /Core handlers
***********************************************************************/
@@ -3442,7 +3450,7 @@ handle_client_start_sub (void *cls,
struct ClientContext *cli_ctx = cls;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Client requested start of a new sub.\n");
- if ((NULL != cli_ctx->sub)&&
+ if ((NULL != cli_ctx->sub) &&
(0 != memcmp (&cli_ctx->sub->hash,
&msg->hash,
sizeof(struct GNUNET_HashCode))) )
@@ -3633,7 +3641,7 @@ handle_peer_pull_request (void *cls,
#if ENABLE_MALICIOUS
if ((1 == mal_type)
- ||(3 == mal_type))
+ || (3 == mal_type))
{ /* Try to maximise representation */
send_pull_reply (peer_ctx, mal_peers, num_mal_peers);
}
@@ -3774,13 +3782,13 @@ handle_peer_pull_reply (void *cls,
#if ENABLE_MALICIOUS
if ((NULL != att_peer_set) &&
- ((1 == mal_type) ||(3 == mal_type) ))
+ ((1 == mal_type) || (3 == mal_type) ))
{ /* Add attacked peer to local list */
// TODO check if we sent a request and this was the first reply
if ((GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set,
&peers[i]))
- &&(GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mal_peer_set,
- &peers[i])) )
+ && (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mal_peer_set,
+ &peers[i])) )
{
tmp_att_peer = GNUNET_new (struct AttackedPeer);
tmp_att_peer->peer_id = peers[i];
@@ -3988,6 +3996,7 @@ check_client_act_malicious (void *cls,
return GNUNET_OK;
}
+
/**
* Turn RPS service to act malicious.
*
@@ -4236,6 +4245,8 @@ do_mal_round (void *cls)
&do_mal_round, sub);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished round\n");
}
+
+
#endif /* ENABLE_MALICIOUS */
@@ -4785,6 +4796,7 @@ client_connect_cb (void *cls,
return cli_ctx;
}
+
/**
* Callback called when a client disconnected from the service
*
diff --git a/src/rps/gnunet-service-rps_custommap.c b/src/rps/gnunet-service-rps_custommap.c
index 8fcfc5558..54e361d32 100644
--- a/src/rps/gnunet-service-rps_custommap.c
+++ b/src/rps/gnunet-service-rps_custommap.c
@@ -87,6 +87,7 @@ CustomPeerMap_create (unsigned int len)
return c_peer_map;
}
+
/**
* Get the size of the custom peer map
*
@@ -102,6 +103,7 @@ CustomPeerMap_size (const struct CustomPeerMap *c_peer_map)
return GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map);
}
+
/**
* Insert peer into the custom peer map
*
@@ -149,6 +151,7 @@ CustomPeerMap_put (const struct CustomPeerMap *c_peer_map,
return GNUNET_NO;
}
+
/**
* Check whether custom peer map contains a peer
*
@@ -165,6 +168,7 @@ CustomPeerMap_contains_peer (const struct CustomPeerMap *c_peer_map,
return GNUNET_CONTAINER_multipeermap_contains (c_peer_map->peer_map, peer);
}
+
/**
* Get index of peer in custom peer map
*
@@ -184,6 +188,7 @@ CustomPeerMap_get_index_pointer (const struct CustomPeerMap *c_peer_map,
return index;
}
+
/**
* Remove peer from custom peer map
*
@@ -243,6 +248,7 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
return GNUNET_OK;
}
+
/**
* Get a peer by index
*
@@ -264,6 +270,7 @@ CustomPeerMap_get_peer_by_index (const struct CustomPeerMap *c_peer_map,
return NULL;
}
+
/**
* Remove peer from custom peer map by index
*
@@ -301,6 +308,7 @@ CustomPeerMap_remove_peer_by_index (const struct CustomPeerMap *c_peer_map,
return GNUNET_OK;
}
+
/**
* Clear the custom peer map
*
@@ -326,6 +334,7 @@ CustomPeerMap_clear (const struct CustomPeerMap *c_peer_map)
GNUNET_assert (0 == CustomPeerMap_size (c_peer_map));
}
+
/**
* Destroy peermap.
*
@@ -340,4 +349,5 @@ CustomPeerMap_destroy (struct CustomPeerMap *c_peer_map)
GNUNET_free (c_peer_map);
}
+
/* end of gnunet-service-rps_custommap.c */
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c
index 7573fd4eb..598cc887e 100644
--- a/src/rps/gnunet-service-rps_sampler.c
+++ b/src/rps/gnunet-service-rps_sampler.c
@@ -216,6 +216,7 @@ RPS_sampler_init (size_t init_size,
return sampler;
}
+
/**
* Get one random peer out of the sampled peers.
*
diff --git a/src/rps/gnunet-service-rps_sampler_elem.c b/src/rps/gnunet-service-rps_sampler_elem.c
index 17b3be6d2..aa8b72445 100644
--- a/src/rps/gnunet-service-rps_sampler_elem.c
+++ b/src/rps/gnunet-service-rps_sampler_elem.c
@@ -152,6 +152,7 @@ RPS_sampler_elem_next (struct RPS_SamplerElement *sampler_elem,
sampler_elem->is_empty = NOT_EMPTY;
}
+
/**
* Set the min-wise independent function of the given sampler element.
*
@@ -165,4 +166,5 @@ RPS_sampler_elem_set (struct RPS_SamplerElement *sampler_elem,
sampler_elem->auth_key = auth_key;
}
+
/* end of gnunet-service-rps.c */
diff --git a/src/rps/gnunet-service-rps_view.c b/src/rps/gnunet-service-rps_view.c
index 5de7c84dc..d58b995a3 100644
--- a/src/rps/gnunet-service-rps_view.c
+++ b/src/rps/gnunet-service-rps_view.c
@@ -290,4 +290,5 @@ View_destroy (struct View *view)
GNUNET_free (view);
}
+
/* end of gnunet-service-rps_view.c */
diff --git a/src/rps/rps-sampler_common.c b/src/rps/rps-sampler_common.c
index ab8c65f17..488ed8e01 100644
--- a/src/rps/rps-sampler_common.c
+++ b/src/rps/rps-sampler_common.c
@@ -354,7 +354,7 @@ RPS_sampler_count_id (struct RPS_Sampler *sampler,
for (i = 0; i < sampler->sampler_size; i++)
{
if ((0 == GNUNET_memcmp (&sampler->sampler_elements[i]->peer_id, id))
- &&(EMPTY != sampler->sampler_elements[i]->is_empty) )
+ && (EMPTY != sampler->sampler_elements[i]->is_empty) )
count++;
}
return count;
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index 66f93d86f..d2cdd3aa7 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -61,7 +61,6 @@ static unsigned num_bits_buf_unaligned;
static struct GNUNET_CONTAINER_MultiHashMap *open_files;
-
/**
* @brief Get file handle
*
@@ -162,7 +161,6 @@ close_all_files ()
}
-
void
to_file_raw (const char *file_name, const char *buf, size_t size_buf)
{
@@ -206,6 +204,7 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf)
"Unable to close file\n");
}
+
void
to_file_raw_unaligned (const char *file_name,
const char *buf,
@@ -372,6 +371,7 @@ to_file_raw_unaligned (const char *file_name,
LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
}
+
char *
auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key)
{
@@ -414,6 +414,7 @@ auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key)
return name_buf;
}
+
#endif /* TO_FILE */
@@ -470,7 +471,7 @@ store_prefix_file_name (const unsigned int index,
64,
"%u",
index);
- if ((64 < out_size)||
+ if ((64 < out_size) ||
(0 > out_size) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -488,7 +489,7 @@ store_prefix_file_name (const unsigned int index,
"/tmp/rps/%s-%s",
prefix,
index_str);
- if ((len_file_name < out_size)||
+ if ((len_file_name < out_size) ||
(0 > out_size) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -507,7 +508,8 @@ store_prefix_file_name (const unsigned int index,
*
* @return Factorial of @a x
*/
-uint32_t fac (uint32_t x)
+uint32_t
+fac (uint32_t x)
{
if (1 >= x)
{
@@ -516,6 +518,7 @@ uint32_t fac (uint32_t x)
return x * fac (x - 1);
}
+
/**
* @brief Binomial coefficient (n choose k)
*
@@ -524,7 +527,8 @@ uint32_t fac (uint32_t x)
*
* @return Binomial coefficient of @a n and @a k
*/
-uint32_t binom (uint32_t n, uint32_t k)
+uint32_t
+binom (uint32_t n, uint32_t k)
{
// GNUNET_assert (n >= k);
if (k > n)
diff --git a/src/rps/rps.h b/src/rps/rps.h
index 32e5d07af..9d42a6104 100644
--- a/src/rps/rps.h
+++ b/src/rps/rps.h
@@ -56,7 +56,6 @@ struct GNUNET_RPS_P2P_PullReplyMessage
};
-
/***********************************************************************
* Client-Service Messages
***********************************************************************/
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c
index 19cbdcf8a..da24ca4c9 100644
--- a/src/rps/rps_api.c
+++ b/src/rps/rps_api.c
@@ -857,7 +857,7 @@ GNUNET_RPS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_free (h);
return NULL;
}
- if ((0 > h->desired_probability)||
+ if ((0 > h->desired_probability) ||
(1 < h->desired_probability) )
{
LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -876,7 +876,7 @@ GNUNET_RPS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_free (h);
return NULL;
}
- if ((0 > h->desired_probability)||
+ if ((0 > h->desired_probability) ||
(1 < h->desired_probability) )
{
LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -1186,6 +1186,8 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
GNUNET_MQ_send (h->mq, ev);
}
+
+
#endif /* ENABLE_MALICIOUS */
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 3a01e73ff..81cf63c72 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -623,9 +623,7 @@ tofile_ (const char *file_name, const char *line)
"Failed to write string to buffer (size: %i)\n",
size);
return;
- } */
-
- size = strlen (line) * sizeof(char);
+ } */size = strlen (line) * sizeof(char);
size2 = GNUNET_DISK_file_write (f, line, size);
if (size != size2)
@@ -649,6 +647,7 @@ tofile_ (const char *file_name, const char *line)
}
}
+
/**
* This function is used to facilitate writing important information to disk
*/
@@ -740,7 +739,8 @@ make_oplist_entry ()
* @return #GNUNET_YES if so
* #GNUNET_NO otherwise
*/
-static int check_statistics_collect_completed_single_peer (
+static int
+check_statistics_collect_completed_single_peer (
const struct RPSPeer *rps_peer)
{
if (cur_test_run.stat_collect_flags !=
@@ -760,7 +760,8 @@ static int check_statistics_collect_completed_single_peer (
* @return #GNUNET_YES if so
* #GNUNET_NO otherwise
*/
-static int check_statistics_collect_completed ()
+static int
+check_statistics_collect_completed ()
{
uint32_t i;
@@ -853,7 +854,7 @@ post_test_op (void *cls)
}
}
/* If we do not collect statistics, shut down directly */
- if ((NO_COLLECT_STATISTICS == cur_test_run.have_collect_statistics)||
+ if ((NO_COLLECT_STATISTICS == cur_test_run.have_collect_statistics) ||
(GNUNET_YES == check_statistics_collect_completed ()) )
{
GNUNET_SCHEDULER_shutdown ();
@@ -871,7 +872,7 @@ seed_peers (void *cls)
unsigned int amount;
unsigned int i;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -925,6 +926,7 @@ seed_peers_big (void *cls)
GNUNET_RPS_seed_ids (peer->rps_handle, amount, ids_to_seed);
}
+
/**
* Get the id of peer i.
*/
@@ -938,12 +940,12 @@ info_cb (void *cb_cls,
(void) op;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
- if ((NULL == pinfo)||(NULL != emsg))
+ if ((NULL == pinfo) || (NULL != emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg);
GNUNET_TESTBED_operation_done (entry->op);
@@ -994,7 +996,7 @@ rps_connect_complete_cb (void *cls,
GNUNET_assert (NULL != ca_result);
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1046,6 +1048,7 @@ rps_connect_adapter (void *cls,
return h;
}
+
/**
* Called to open a connection to the peer's statistics
*
@@ -1065,6 +1068,7 @@ stat_connect_adapter (void *cls,
return peer->stats_h;
}
+
/**
* Called to disconnect from peer's statistics service
*
@@ -1086,6 +1090,7 @@ stat_disconnect_adapter (void *cls, void *op_result)
peer->stats_h = NULL;
}
+
/**
* Called after successfully opening a connection to a peer's statistics
* service; we register statistics monitoring for CORE and NSE here.
@@ -1156,20 +1161,24 @@ default_eval_cb (void)
return evaluate ();
}
+
static int
no_eval (void)
{
return 0;
}
+
/**
* Initialise given RPSPeer
*/
-static void default_init_peer (struct RPSPeer *rps_peer)
+static void
+default_init_peer (struct RPSPeer *rps_peer)
{
rps_peer->num_ids_to_request = 1;
}
+
/**
* Callback to call on receipt of a reply
*
@@ -1206,7 +1215,7 @@ default_reply_handle (void *cls,
rps_peer->num_recv_ids++;
}
- if ((0 == evaluate ())&&(HAVE_QUICK_QUIT == cur_test_run.have_quick_quit))
+ if ((0 == evaluate ()) && (HAVE_QUICK_QUIT == cur_test_run.have_quick_quit))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test succeeded before timeout\n");
GNUNET_assert (NULL != post_test_task);
@@ -1216,6 +1225,7 @@ default_reply_handle (void *cls,
}
}
+
/**
* Request random peers.
*/
@@ -1226,7 +1236,7 @@ request_peers (void *cls)
struct RPSPeer *rps_peer;
struct PendingReply *pending_rep;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
return;
rps_peer = pending_req->rps_peer;
GNUNET_assert (1 <= rps_peer->num_pending_reqs);
@@ -1248,6 +1258,7 @@ request_peers (void *cls)
rps_peer->num_pending_reqs--;
}
+
static void
cancel_pending_req (struct PendingRequest *pending_req)
{
@@ -1264,6 +1275,7 @@ cancel_pending_req (struct PendingRequest *pending_req)
GNUNET_free (pending_req);
}
+
static void
cancel_request (struct PendingReply *pending_rep)
{
@@ -1280,6 +1292,7 @@ cancel_request (struct PendingReply *pending_rep)
GNUNET_free (pending_rep);
}
+
/**
* Cancel a request.
*/
@@ -1289,7 +1302,7 @@ cancel_request_cb (void *cls)
struct RPSPeer *rps_peer = cls;
struct PendingReply *pending_rep;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
return;
pending_rep = rps_peer->pending_rep_head;
GNUNET_assert (1 <= rps_peer->num_pending_reps);
@@ -1330,6 +1343,7 @@ schedule_missing_requests (struct RPSPeer *rps_peer)
}
}
+
void
cancel_pending_req_rep (struct RPSPeer *rps_peer)
{
@@ -1343,6 +1357,7 @@ cancel_pending_req_rep (struct RPSPeer *rps_peer)
GNUNET_assert (0 == rps_peer->num_pending_reps);
}
+
/***********************************
* MALICIOUS
***********************************/
@@ -1350,7 +1365,8 @@ cancel_pending_req_rep (struct RPSPeer *rps_peer)
/**
* Initialise only non-mal RPSPeers
*/
-static void mal_init_peer (struct RPSPeer *rps_peer)
+static void
+mal_init_peer (struct RPSPeer *rps_peer)
{
if (rps_peer->index >= round (portion * num_peers))
rps_peer->num_ids_to_request = 1;
@@ -1390,12 +1406,13 @@ mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
#endif /* ENABLE_MALICIOUS */
}
+
static void
mal_cb (struct RPSPeer *rps_peer)
{
uint32_t num_mal_peers;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1423,7 +1440,7 @@ mal_cb (struct RPSPeer *rps_peer)
static void
single_req_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1431,13 +1448,14 @@ single_req_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
/***********************************
* DELAYED_REQUESTS
***********************************/
static void
delay_req_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1445,13 +1463,14 @@ delay_req_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
/***********************************
* SEED
***********************************/
static void
seed_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1461,13 +1480,14 @@ seed_cb (struct RPSPeer *rps_peer)
seed_peers, rps_peer);
}
+
/***********************************
* SEED_BIG
***********************************/
static void
seed_big_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1478,6 +1498,7 @@ seed_big_cb (struct RPSPeer *rps_peer)
seed_peers_big, rps_peer);
}
+
/***********************************
* SINGLE_PEER_SEED
***********************************/
@@ -1488,13 +1509,14 @@ single_peer_seed_cb (struct RPSPeer *rps_peer)
// TODO
}
+
/***********************************
* SEED_REQUEST
***********************************/
static void
seed_req_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1505,6 +1527,7 @@ seed_req_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
// TODO start big mal
/***********************************
@@ -1513,7 +1536,7 @@ seed_req_cb (struct RPSPeer *rps_peer)
static void
req_cancel_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1525,6 +1548,7 @@ req_cancel_cb (struct RPSPeer *rps_peer)
cancel_request_cb, rps_peer);
}
+
/***********************************
* CHURN
***********************************/
@@ -1546,13 +1570,13 @@ churn (void *cls);
static void
churn_test_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
/* Start churn */
- if ((HAVE_CHURN == cur_test_run.have_churn)&&(NULL == churn_task))
+ if ((HAVE_CHURN == cur_test_run.have_churn) && (NULL == churn_task))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting churn task\n");
@@ -1570,6 +1594,7 @@ churn_test_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
/***********************************
* SUB
***********************************/
@@ -1633,6 +1658,7 @@ sub_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
rps_peer);
}
+
/***********************************
* PROFILER
***********************************/
@@ -1653,7 +1679,7 @@ churn_cb (void *cls,
// FIXME
struct OpListEntry *entry = cls;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1725,6 +1751,7 @@ churn_cb (void *cls,
// run_round ();
}
+
/**
* @brief Set the rps-service up or down for a specific peer
*
@@ -1791,7 +1818,7 @@ churn (void *cls)
double portion_go_online;
double portion_go_offline;
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
@@ -1852,7 +1879,8 @@ churn (void *cls)
/**
* Initialise given RPSPeer
*/
-static void profiler_init_peer (struct RPSPeer *rps_peer)
+static void
+profiler_init_peer (struct RPSPeer *rps_peer)
{
if (num_peers - 1 == rps_peer->index)
rps_peer->num_ids_to_request = cur_test_run.num_requests;
@@ -1907,13 +1935,13 @@ profiler_reply_handle (void *cls,
static void
profiler_cb (struct RPSPeer *rps_peer)
{
- if ((GNUNET_YES == in_shutdown)||(GNUNET_YES == post_test))
+ if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
{
return;
}
/* Start churn */
- if ((HAVE_CHURN == cur_test_run.have_churn)&&(NULL == churn_task))
+ if ((HAVE_CHURN == cur_test_run.have_churn) && (NULL == churn_task))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting churn task\n");
@@ -1935,6 +1963,7 @@ profiler_cb (struct RPSPeer *rps_peer)
schedule_missing_requests (rps_peer);
}
+
/**
* Function called from #profiler_eval with a filename.
*
@@ -1972,6 +2001,7 @@ file_name_cb (void *cls, const char *filename)
return GNUNET_OK;
}
+
/**
* This is run after the test finished.
*
@@ -1998,7 +2028,8 @@ profiler_eval (void)
*
* @return
*/
-static int is_in_view (uint32_t a, uint32_t b)
+static int
+is_in_view (uint32_t a, uint32_t b)
{
uint32_t i;
@@ -2014,7 +2045,9 @@ static int is_in_view (uint32_t a, uint32_t b)
return GNUNET_NO;
}
-static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
+
+static uint32_t
+get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
{
uint32_t i;
@@ -2034,6 +2067,7 @@ static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
GNUNET_assert (0);
}
+
/**
* @brief Counts number of peers in view of a that have b in their view
*
@@ -2042,7 +2076,8 @@ static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
*
* @return
*/
-static uint32_t count_containing_views (uint32_t a, uint32_t b)
+static uint32_t
+count_containing_views (uint32_t a, uint32_t b)
{
uint32_t i;
uint32_t peer_idx;
@@ -2059,13 +2094,15 @@ static uint32_t count_containing_views (uint32_t a, uint32_t b)
return count;
}
+
/**
* @brief Computes the probability for each other peer to be selected by the
* sampling process based on the views of all peers
*
* @param peer_idx index of the peer that is about to sample
*/
-static void compute_probabilities (uint32_t peer_idx)
+static void
+compute_probabilities (uint32_t peer_idx)
{
// double probs[num_peers] = { 0 };
double probs[num_peers];
@@ -2197,6 +2234,7 @@ static void compute_probabilities (uint32_t peer_idx)
GNUNET_free (probs_as_str);
}
+
/**
* @brief This counts the number of peers in which views a given peer occurs.
*
@@ -2206,7 +2244,8 @@ static void compute_probabilities (uint32_t peer_idx)
*
* @return the number of occurrences
*/
-static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
+static uint32_t
+count_peer_in_views_2 (uint32_t peer_idx)
{
uint32_t i, j;
uint32_t count = 0;
@@ -2228,7 +2267,9 @@ static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
return count;
}
-static uint32_t cumulated_view_sizes ()
+
+static uint32_t
+cumulated_view_sizes ()
{
uint32_t i;
@@ -2240,7 +2281,9 @@ static uint32_t cumulated_view_sizes ()
return view_sizes;
}
-static void count_peer_in_views (uint32_t *count_peers)
+
+static void
+count_peer_in_views (uint32_t *count_peers)
{
uint32_t i, j;
@@ -2258,7 +2301,9 @@ static void count_peer_in_views (uint32_t *count_peers)
}
}
-void compute_diversity ()
+
+void
+compute_diversity ()
{
uint32_t i;
/* ith entry represents the numer of occurrences in other peer's views */
@@ -2301,7 +2346,9 @@ void compute_diversity ()
GNUNET_free (deviation);
}
-void print_view_sizes ()
+
+void
+print_view_sizes ()
{
uint32_t i;
@@ -2315,15 +2362,19 @@ void print_view_sizes ()
}
}
-void all_views_updated_cb ()
+
+void
+all_views_updated_cb ()
{
compute_diversity ();
print_view_sizes ();
}
-void view_update_cb (void *cls,
- uint64_t view_size,
- const struct GNUNET_PeerIdentity *peers)
+
+void
+view_update_cb (void *cls,
+ uint64_t view_size,
+ const struct GNUNET_PeerIdentity *peers)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"View was updated (%" PRIu64 ")\n", view_size);
@@ -2372,6 +2423,7 @@ void view_update_cb (void *cls,
all_views_updated_cb ();
}
+
static void
pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
{
@@ -2380,7 +2432,9 @@ pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
GNUNET_RPS_view_request (h, 0, view_update_cb, rps_peer);
}
-void write_final_stats (void)
+
+void
+write_final_stats (void)
{
uint32_t i;
@@ -2416,6 +2470,7 @@ void write_final_stats (void)
}
}
+
/**
* Continuation called by #GNUNET_STATISTICS_get() functions.
*
@@ -2448,7 +2503,7 @@ post_test_shutdown_ready_cb (void *cls,
GNUNET_break (0);
}
- if ((NULL != rps_peer->stat_op)&&
+ if ((NULL != rps_peer->stat_op) &&
(GNUNET_YES == check_statistics_collect_completed_single_peer (
rps_peer)) )
{
@@ -2470,6 +2525,7 @@ post_test_shutdown_ready_cb (void *cls,
}
}
+
/**
* @brief Converts string representation to the corresponding #STAT_TYPE enum.
*
@@ -2477,7 +2533,8 @@ post_test_shutdown_ready_cb (void *cls,
*
* @return corresponding enum
*/
-enum STAT_TYPE stat_str_2_type (const char *stat_str)
+enum STAT_TYPE
+stat_str_2_type (const char *stat_str)
{
if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen (
"# rounds blocked - no pull replies")))
@@ -2571,7 +2628,8 @@ enum STAT_TYPE stat_str_2_type (const char *stat_str)
*
* @return string representation that matches statistics value
*/
-char*stat_type_2_str (enum STAT_TYPE stat_type)
+char*
+stat_type_2_str (enum STAT_TYPE stat_type)
{
switch (stat_type)
{
@@ -2630,6 +2688,7 @@ char*stat_type_2_str (enum STAT_TYPE stat_type)
}
}
+
/**
* Callback function to process statistic values.
*
@@ -2735,7 +2794,9 @@ stat_iterator (void *cls,
return GNUNET_OK;
}
-void post_profiler (struct RPSPeer *rps_peer)
+
+void
+post_profiler (struct RPSPeer *rps_peer)
{
if (COLLECT_STATISTICS != cur_test_run.have_collect_statistics)
{
@@ -2808,7 +2869,7 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n");
/* Check whether we timed out */
- if ((n_peers != num_peers)||
+ if ((n_peers != num_peers) ||
(NULL == peers) ||
(0 == links_succeeded) )
{
diff --git a/src/rps/test_rps_api.c b/src/rps/test_rps_api.c
index 6fca7ea12..06dad2887 100644
--- a/src/rps/test_rps_api.c
+++ b/src/rps/test_rps_api.c
@@ -83,4 +83,5 @@ main (int argc, char *argv[])
return check ();
}
+
/* end of test_rps_api.c */
diff --git a/src/rps/test_service_rps_custommap.c b/src/rps/test_service_rps_custommap.c
index 6f6f6b0d3..05590b097 100644
--- a/src/rps/test_service_rps_custommap.c
+++ b/src/rps/test_service_rps_custommap.c
@@ -123,4 +123,5 @@ main (int argc, char *argv[])
return check ();
}
+
/* end of test_service_rps_custommap.c */
diff --git a/src/rps/test_service_rps_sampler_elem.c b/src/rps/test_service_rps_sampler_elem.c
index 706abf4f9..8fef5adaf 100644
--- a/src/rps/test_service_rps_sampler_elem.c
+++ b/src/rps/test_service_rps_sampler_elem.c
@@ -209,4 +209,5 @@ main (int argc, char *argv[])
return check ();
}
+
/* end of test_service_rps_peers.c */
diff --git a/src/rps/test_service_rps_view.c b/src/rps/test_service_rps_view.c
index 5b668efe1..5a8c00849 100644
--- a/src/rps/test_service_rps_view.c
+++ b/src/rps/test_service_rps_view.c
@@ -141,4 +141,5 @@ main ()
return check ();
}
+
/* end of test_service_rps_view.c */