aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-03-25 17:16:52 +0000
committerJulius Bünger <buenger@mytum.de>2015-03-25 17:16:52 +0000
commit4edbbc4b4a548d90ac53fe448514b6bbccee3b87 (patch)
tree0dc751aa3702284dd3426925814084426e512fb7 /src
parent1f4fa719d547b78dd62f5a613e1ec6632c00ee11 (diff)
downloadgnunet-4edbbc4b4a548d90ac53fe448514b6bbccee3b87.tar.gz
gnunet-4edbbc4b4a548d90ac53fe448514b6bbccee3b87.zip
-optical changes
Diffstat (limited to 'src')
-rw-r--r--src/rps/gnunet-service-rps.c13
-rw-r--r--src/rps/rps_api.c3
2 files changed, 9 insertions, 7 deletions
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,
1035 GNUNET_free (ids); 1035 GNUNET_free (ids);
1036 1036
1037 cli_ctx = GNUNET_SERVER_client_get_user_context (client, struct client_ctx); 1037 cli_ctx = GNUNET_SERVER_client_get_user_context (client, struct client_ctx);
1038 if ( NULL == cli_ctx ) { 1038 if (NULL == cli_ctx) {
1039 cli_ctx = GNUNET_new (struct client_ctx); 1039 cli_ctx = GNUNET_new (struct client_ctx);
1040 cli_ctx->mq = GNUNET_MQ_queue_for_server_client (client); 1040 cli_ctx->mq = GNUNET_MQ_queue_for_server_client (client);
1041 GNUNET_SERVER_client_set_user_context (client, cli_ctx); 1041 GNUNET_SERVER_client_set_user_context (client, cli_ctx);
@@ -1096,8 +1096,8 @@ handle_client_request (void *cls,
1096 */ 1096 */
1097 static void 1097 static void
1098handle_client_seed (void *cls, 1098handle_client_seed (void *cls,
1099 struct GNUNET_SERVER_Client *client, 1099 struct GNUNET_SERVER_Client *client,
1100 const struct GNUNET_MessageHeader *message) 1100 const struct GNUNET_MessageHeader *message)
1101{ 1101{
1102 struct GNUNET_RPS_CS_SeedMessage *in_msg; 1102 struct GNUNET_RPS_CS_SeedMessage *in_msg;
1103 struct GNUNET_PeerIdentity *peers; 1103 struct GNUNET_PeerIdentity *peers;
@@ -1204,8 +1204,9 @@ handle_peer_pull_request (void *cls,
1204 struct GNUNET_RPS_P2P_PullReplyMessage *out_msg; 1204 struct GNUNET_RPS_P2P_PullReplyMessage *out_msg;
1205 1205
1206 1206
1207 peer = (struct GNUNET_PeerIdentity *) GNUNET_CADET_channel_get_info (channel, 1207 peer = (struct GNUNET_PeerIdentity *)
1208 GNUNET_CADET_OPTION_PEER); 1208 GNUNET_CADET_channel_get_info (channel,
1209 GNUNET_CADET_OPTION_PEER);
1209 // FIXME wait for cadet to change this function 1210 // FIXME wait for cadet to change this function
1210 1211
1211 /* Compute actual size */ 1212 /* Compute actual size */
@@ -1215,6 +1216,7 @@ handle_peer_pull_request (void *cls,
1215 if (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE < send_size) 1216 if (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE < send_size)
1216 /* Compute number of peers to send 1217 /* Compute number of peers to send
1217 * If too long, simply truncate */ 1218 * If too long, simply truncate */
1219 // TODO select random ones via permutation
1218 send_size = 1220 send_size =
1219 (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE - 1221 (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE -
1220 sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / 1222 sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) /
@@ -1301,6 +1303,7 @@ handle_peer_pull_reply (void *cls,
1301 return GNUNET_OK; 1303 return GNUNET_OK;
1302 } 1304 }
1303 1305
1306
1304 /* Do actual logic */ 1307 /* Do actual logic */
1305 peers = (struct GNUNET_PeerIdentity *) &msg[1]; 1308 peers = (struct GNUNET_PeerIdentity *) &msg[1];
1306 for (i = 0 ; i < ntohl (in_msg->num_peers) ; i++) 1309 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,
333 /* The actual size the message occupies */ 333 /* The actual size the message occupies */
334 size_needed = sizeof (struct GNUNET_RPS_CS_SeedMessage) + 334 size_needed = sizeof (struct GNUNET_RPS_CS_SeedMessage) +
335 num_peers * sizeof (struct GNUNET_PeerIdentity); 335 num_peers * sizeof (struct GNUNET_PeerIdentity);
336 /* The number of peers that fits in one message together with 336 /* The number of peers that fit in one message together with
337 * the respective header */ 337 * the respective header */
338 num_peers_max = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 338 num_peers_max = (GNUNET_SERVER_MAX_MESSAGE_SIZE -
339 sizeof (struct GNUNET_RPS_CS_SeedMessage)) / 339 sizeof (struct GNUNET_RPS_CS_SeedMessage)) /
@@ -365,7 +365,6 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
365 memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity)); 365 memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity));
366 366
367 GNUNET_MQ_send (h->mq, ev); 367 GNUNET_MQ_send (h->mq, ev);
368
369} 368}
370#endif /* ENABLE_MALICIOUS */ 369#endif /* ENABLE_MALICIOUS */
371 370