From 4edbbc4b4a548d90ac53fe448514b6bbccee3b87 Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Wed, 25 Mar 2015 17:16:52 +0000 Subject: -optical changes --- src/rps/gnunet-service-rps.c | 13 ++++++++----- src/rps/rps_api.c | 3 +-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 26778a14e..9d60ee8f5 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -1035,7 +1035,7 @@ void client_respond (void *cls, GNUNET_free (ids); cli_ctx = GNUNET_SERVER_client_get_user_context (client, struct client_ctx); - if ( NULL == cli_ctx ) { + if (NULL == cli_ctx) { cli_ctx = GNUNET_new (struct client_ctx); cli_ctx->mq = GNUNET_MQ_queue_for_server_client (client); GNUNET_SERVER_client_set_user_context (client, cli_ctx); @@ -1096,8 +1096,8 @@ handle_client_request (void *cls, */ static void handle_client_seed (void *cls, - struct GNUNET_SERVER_Client *client, - const struct GNUNET_MessageHeader *message) + struct GNUNET_SERVER_Client *client, + const struct GNUNET_MessageHeader *message) { struct GNUNET_RPS_CS_SeedMessage *in_msg; struct GNUNET_PeerIdentity *peers; @@ -1204,8 +1204,9 @@ handle_peer_pull_request (void *cls, struct GNUNET_RPS_P2P_PullReplyMessage *out_msg; - peer = (struct GNUNET_PeerIdentity *) GNUNET_CADET_channel_get_info (channel, - GNUNET_CADET_OPTION_PEER); + peer = (struct GNUNET_PeerIdentity *) + GNUNET_CADET_channel_get_info (channel, + GNUNET_CADET_OPTION_PEER); // FIXME wait for cadet to change this function /* Compute actual size */ @@ -1215,6 +1216,7 @@ handle_peer_pull_request (void *cls, if (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE < send_size) /* Compute number of peers to send * If too long, simply truncate */ + // TODO select random ones via permutation send_size = (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / @@ -1301,6 +1303,7 @@ handle_peer_pull_reply (void *cls, return GNUNET_OK; } + /* Do actual logic */ peers = (struct GNUNET_PeerIdentity *) &msg[1]; for (i = 0 ; i < ntohl (in_msg->num_peers) ; i++) diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c index f8406bd50..639476e9f 100644 --- a/src/rps/rps_api.c +++ b/src/rps/rps_api.c @@ -333,7 +333,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h, /* The actual size the message occupies */ size_needed = sizeof (struct GNUNET_RPS_CS_SeedMessage) + num_peers * sizeof (struct GNUNET_PeerIdentity); - /* The number of peers that fits in one message together with + /* The number of peers that fit in one message together with * the respective header */ num_peers_max = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_RPS_CS_SeedMessage)) / @@ -365,7 +365,6 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h, memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity)); GNUNET_MQ_send (h->mq, ev); - } #endif /* ENABLE_MALICIOUS */ -- cgit v1.2.3