aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-08-23 15:07:46 +0200
committerJulius Bünger <buenger@mytum.de>2018-08-23 15:07:46 +0200
commit517266896853562ea49c26e707419ca0c5444fff (patch)
tree8153136c0d8717e2f956cbd1d97ba34309cf8e57 /src/rps/gnunet-service-rps.c
parent6339dc3bdbf1a908d288d7bad4a7332a1179c253 (diff)
downloadgnunet-517266896853562ea49c26e707419ca0c5444fff.tar.gz
gnunet-517266896853562ea49c26e707419ca0c5444fff.zip
Refactor code mostly visually to prevent compiler warnings
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r--src/rps/gnunet-service-rps.c60
1 files changed, 48 insertions, 12 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 0c0fe9076..84aa1c51c 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -465,6 +465,8 @@ get_rand_peer_iterator (void *cls,
465 void *value) 465 void *value)
466{ 466{
467 struct GetRandPeerIteratorCls *iterator_cls = cls; 467 struct GetRandPeerIteratorCls *iterator_cls = cls;
468 (void) value;
469
468 if (0 >= iterator_cls->index) 470 if (0 >= iterator_cls->index)
469 { 471 {
470 iterator_cls->peer = peer; 472 iterator_cls->peer = peer;
@@ -762,12 +764,13 @@ insert_pending_message (const struct GNUNET_PeerIdentity *peer,
762 * @brief Remove a pending message from the respective DLL 764 * @brief Remove a pending message from the respective DLL
763 * 765 *
764 * @param pending_msg the pending message to remove 766 * @param pending_msg the pending message to remove
765 * @param cancel cancel the pending message, too 767 * @param cancel whether to cancel the pending message, too
766 */ 768 */
767static void 769static void
768remove_pending_message (struct PendingMessage *pending_msg, int cancel) 770remove_pending_message (struct PendingMessage *pending_msg, int cancel)
769{ 771{
770 struct PeerContext *peer_ctx; 772 struct PeerContext *peer_ctx;
773 (void) cancel;
771 774
772 peer_ctx = pending_msg->peer_ctx; 775 peer_ctx = pending_msg->peer_ctx;
773 GNUNET_assert (NULL != peer_ctx); 776 GNUNET_assert (NULL != peer_ctx);
@@ -1026,6 +1029,8 @@ peermap_clear_iterator (void *cls,
1026 const struct GNUNET_PeerIdentity *key, 1029 const struct GNUNET_PeerIdentity *key,
1027 void *value) 1030 void *value)
1028{ 1031{
1032 (void) cls;
1033 (void) value;
1029 destroy_peer (get_peer_ctx (key)); 1034 destroy_peer (get_peer_ctx (key));
1030 return GNUNET_YES; 1035 return GNUNET_YES;
1031} 1036}
@@ -1079,6 +1084,7 @@ store_peer_presistently_iterator (void *cls,
1079 char peer_string[128]; 1084 char peer_string[128];
1080 int size; 1085 int size;
1081 ssize_t ret; 1086 ssize_t ret;
1087 (void) value;
1082 1088
1083 if (NULL == peer) 1089 if (NULL == peer)
1084 { 1090 {
@@ -1322,6 +1328,7 @@ valid_peer_iterator (void *cls,
1322 void *value) 1328 void *value)
1323{ 1329{
1324 struct PeersIteratorCls *it_cls = cls; 1330 struct PeersIteratorCls *it_cls = cls;
1331 (void) value;
1325 1332
1326 return it_cls->iterator (it_cls->cls, 1333 return it_cls->iterator (it_cls->cls,
1327 peer); 1334 peer);
@@ -1534,6 +1541,7 @@ handle_inbound_channel (void *cls,
1534 struct PeerContext *peer_ctx; 1541 struct PeerContext *peer_ctx;
1535 struct GNUNET_PeerIdentity *ctx_peer; 1542 struct GNUNET_PeerIdentity *ctx_peer;
1536 struct ChannelCtx *channel_ctx; 1543 struct ChannelCtx *channel_ctx;
1544 (void) cls;
1537 1545
1538 LOG (GNUNET_ERROR_TYPE_DEBUG, 1546 LOG (GNUNET_ERROR_TYPE_DEBUG,
1539 "New channel was established to us (Peer %s).\n", 1547 "New channel was established to us (Peer %s).\n",
@@ -1661,7 +1669,7 @@ send_message (const struct GNUNET_PeerIdentity *peer,
1661 */ 1669 */
1662static int 1670static int
1663schedule_operation (const struct GNUNET_PeerIdentity *peer, 1671schedule_operation (const struct GNUNET_PeerIdentity *peer,
1664 const PeerOp peer_op) 1672 const PeerOp peer_op)
1665{ 1673{
1666 struct PeerPendingOp pending_op; 1674 struct PeerPendingOp pending_op;
1667 struct PeerContext *peer_ctx; 1675 struct PeerContext *peer_ctx;
@@ -2162,10 +2170,11 @@ clients_notify_view_update (void);
2162 */ 2170 */
2163static void 2171static void
2164hist_update (void *cls, 2172hist_update (void *cls,
2165 struct GNUNET_PeerIdentity *ids, 2173 struct GNUNET_PeerIdentity *ids,
2166 uint32_t num_peers) 2174 uint32_t num_peers)
2167{ 2175{
2168 unsigned int i; 2176 unsigned int i;
2177 (void) cls;
2169 2178
2170 for (i = 0; i < num_peers; i++) 2179 for (i = 0; i < num_peers; i++)
2171 { 2180 {
@@ -2355,8 +2364,9 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id,
2355 */ 2364 */
2356static void 2365static void
2357insert_in_pull_map (void *cls, 2366insert_in_pull_map (void *cls,
2358 const struct GNUNET_PeerIdentity *peer) 2367 const struct GNUNET_PeerIdentity *peer)
2359{ 2368{
2369 (void) cls;
2360 CustomPeerMap_put (pull_map, peer); 2370 CustomPeerMap_put (pull_map, peer);
2361} 2371}
2362 2372
@@ -2369,8 +2379,9 @@ insert_in_pull_map (void *cls,
2369 */ 2379 */
2370static void 2380static void
2371insert_in_view_op (void *cls, 2381insert_in_view_op (void *cls,
2372 const struct GNUNET_PeerIdentity *peer) 2382 const struct GNUNET_PeerIdentity *peer)
2373{ 2383{
2384 (void) cls;
2374 (void) insert_in_view (peer); 2385 (void) insert_in_view (peer);
2375} 2386}
2376 2387
@@ -2381,8 +2392,9 @@ insert_in_view_op (void *cls,
2381 */ 2392 */
2382static void 2393static void
2383insert_in_sampler (void *cls, 2394insert_in_sampler (void *cls,
2384 const struct GNUNET_PeerIdentity *peer) 2395 const struct GNUNET_PeerIdentity *peer)
2385{ 2396{
2397 (void) cls;
2386 LOG (GNUNET_ERROR_TYPE_DEBUG, 2398 LOG (GNUNET_ERROR_TYPE_DEBUG,
2387 "Updating samplers with peer %s from insert_in_sampler()\n", 2399 "Updating samplers with peer %s from insert_in_sampler()\n",
2388 GNUNET_i2s (peer)); 2400 GNUNET_i2s (peer));
@@ -2539,6 +2551,8 @@ cleanup_destroyed_channel (void *cls,
2539{ 2551{
2540 struct ChannelCtx *channel_ctx = cls; 2552 struct ChannelCtx *channel_ctx = cls;
2541 struct PeerContext *peer_ctx = channel_ctx->peer_ctx; 2553 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
2554 (void) cls;
2555 (void) channel;
2542 2556
2543 channel_ctx->channel = NULL; 2557 channel_ctx->channel = NULL;
2544 remove_channel_ctx (channel_ctx); 2558 remove_channel_ctx (channel_ctx);
@@ -2597,11 +2611,13 @@ destroy_cli_ctx (struct ClientContext *cli_ctx)
2597 */ 2611 */
2598static void 2612static void
2599nse_callback (void *cls, 2613nse_callback (void *cls,
2600 struct GNUNET_TIME_Absolute timestamp, 2614 struct GNUNET_TIME_Absolute timestamp,
2601 double logestimate, double std_dev) 2615 double logestimate, double std_dev)
2602{ 2616{
2603 double estimate; 2617 double estimate;
2604 //double scale; // TODO this might go gloabal/config 2618 //double scale; // TODO this might go gloabal/config
2619 (void) cls;
2620 (void) timestamp;
2605 2621
2606 LOG (GNUNET_ERROR_TYPE_DEBUG, 2622 LOG (GNUNET_ERROR_TYPE_DEBUG,
2607 "Received a ns estimate - logest: %f, std_dev: %f (old_size: %u)\n", 2623 "Received a ns estimate - logest: %f, std_dev: %f (old_size: %u)\n",
@@ -2923,6 +2939,7 @@ handle_client_view_request (void *cls,
2923 GNUNET_SERVICE_client_continue (cli_ctx->client); 2939 GNUNET_SERVICE_client_continue (cli_ctx->client);
2924} 2940}
2925 2941
2942
2926/** 2943/**
2927 * Handle a CHECK_LIVE message from another peer. 2944 * Handle a CHECK_LIVE message from another peer.
2928 * 2945 *
@@ -2938,6 +2955,8 @@ handle_peer_check (void *cls,
2938{ 2955{
2939 const struct ChannelCtx *channel_ctx = cls; 2956 const struct ChannelCtx *channel_ctx = cls;
2940 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; 2957 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
2958 (void) msg;
2959
2941 LOG (GNUNET_ERROR_TYPE_DEBUG, 2960 LOG (GNUNET_ERROR_TYPE_DEBUG,
2942 "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer)); 2961 "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer));
2943 2962
@@ -2959,6 +2978,7 @@ handle_peer_push (void *cls,
2959{ 2978{
2960 const struct ChannelCtx *channel_ctx = cls; 2979 const struct ChannelCtx *channel_ctx = cls;
2961 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; 2980 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
2981 (void) msg;
2962 2982
2963 // (check the proof of work (?)) 2983 // (check the proof of work (?))
2964 2984
@@ -3022,6 +3042,7 @@ handle_peer_pull_request (void *cls,
3022 const struct ChannelCtx *channel_ctx = cls; 3042 const struct ChannelCtx *channel_ctx = cls;
3023 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; 3043 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
3024 const struct GNUNET_PeerIdentity *view_array; 3044 const struct GNUNET_PeerIdentity *view_array;
3045 (void) msg;
3025 3046
3026 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); 3047 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer));
3027 GNUNET_STATISTICS_update(stats, "# pull request message received", 1, GNUNET_NO); 3048 GNUNET_STATISTICS_update(stats, "# pull request message received", 1, GNUNET_NO);
@@ -3429,6 +3450,7 @@ do_mal_round (void *cls)
3429 uint32_t i; 3450 uint32_t i;
3430 struct GNUNET_TIME_Relative time_next_round; 3451 struct GNUNET_TIME_Relative time_next_round;
3431 struct AttackedPeer *tmp_att_peer; 3452 struct AttackedPeer *tmp_att_peer;
3453 (void) cls;
3432 3454
3433 LOG (GNUNET_ERROR_TYPE_DEBUG, 3455 LOG (GNUNET_ERROR_TYPE_DEBUG,
3434 "Going to execute next round maliciously type %" PRIu32 ".\n", 3456 "Going to execute next round maliciously type %" PRIu32 ".\n",
@@ -3554,7 +3576,7 @@ do_mal_round (void *cls)
3554static void 3576static void
3555do_round (void *cls) 3577do_round (void *cls)
3556{ 3578{
3557 uint32_t i; 3579 unsigned int i;
3558 const struct GNUNET_PeerIdentity *view_array; 3580 const struct GNUNET_PeerIdentity *view_array;
3559 unsigned int *permut; 3581 unsigned int *permut;
3560 unsigned int a_peers; /* Number of peers we send pushes to */ 3582 unsigned int a_peers; /* Number of peers we send pushes to */
@@ -3563,6 +3585,7 @@ do_round (void *cls)
3563 uint32_t second_border; 3585 uint32_t second_border;
3564 struct GNUNET_PeerIdentity peer; 3586 struct GNUNET_PeerIdentity peer;
3565 struct GNUNET_PeerIdentity *update_peer; 3587 struct GNUNET_PeerIdentity *update_peer;
3588 (void) cls;
3566 3589
3567 LOG (GNUNET_ERROR_TYPE_DEBUG, 3590 LOG (GNUNET_ERROR_TYPE_DEBUG,
3568 "Going to execute next round.\n"); 3591 "Going to execute next round.\n");
@@ -3811,6 +3834,11 @@ init_peer_cb (void *cls,
3811 unsigned int best_path) // "How long is the best path? 3834 unsigned int best_path) // "How long is the best path?
3812 // (0 = unknown, 1 = ourselves, 2 = neighbor)" 3835 // (0 = unknown, 1 = ourselves, 2 = neighbor)"
3813{ 3836{
3837 (void) cls;
3838 (void) tunnel;
3839 (void) n_paths;
3840 (void) best_path;
3841
3814 if (NULL != peer) 3842 if (NULL != peer)
3815 { 3843 {
3816 LOG (GNUNET_ERROR_TYPE_DEBUG, 3844 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -3835,6 +3863,8 @@ static int
3835valid_peers_iterator (void *cls, 3863valid_peers_iterator (void *cls,
3836 const struct GNUNET_PeerIdentity *peer) 3864 const struct GNUNET_PeerIdentity *peer)
3837{ 3865{
3866 (void) cls;
3867
3838 if (NULL != peer) 3868 if (NULL != peer)
3839 { 3869 {
3840 LOG (GNUNET_ERROR_TYPE_DEBUG, 3870 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -3860,6 +3890,10 @@ process_peerinfo_peers (void *cls,
3860 const struct GNUNET_HELLO_Message *hello, 3890 const struct GNUNET_HELLO_Message *hello,
3861 const char *err_msg) 3891 const char *err_msg)
3862{ 3892{
3893 (void) cls;
3894 (void) hello;
3895 (void) err_msg;
3896
3863 if (NULL != peer) 3897 if (NULL != peer)
3864 { 3898 {
3865 LOG (GNUNET_ERROR_TYPE_DEBUG, 3899 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -3880,6 +3914,7 @@ shutdown_task (void *cls)
3880{ 3914{
3881 struct ClientContext *client_ctx; 3915 struct ClientContext *client_ctx;
3882 struct ReplyCls *reply_cls; 3916 struct ReplyCls *reply_cls;
3917 (void) cls;
3883 3918
3884 in_shutdown = GNUNET_YES; 3919 in_shutdown = GNUNET_YES;
3885 3920
@@ -3903,8 +3938,8 @@ shutdown_task (void *cls)
3903 GNUNET_free (reply_cls); 3938 GNUNET_free (reply_cls);
3904 } 3939 }
3905 GNUNET_CONTAINER_DLL_remove (cli_ctx_head, 3940 GNUNET_CONTAINER_DLL_remove (cli_ctx_head,
3906 cli_ctx_tail, 3941 cli_ctx_tail,
3907 client_ctx); 3942 client_ctx);
3908 GNUNET_free (client_ctx); 3943 GNUNET_free (client_ctx);
3909 } 3944 }
3910 GNUNET_PEERINFO_notify_cancel (peerinfo_notify_handle); 3945 GNUNET_PEERINFO_notify_cancel (peerinfo_notify_handle);
@@ -3974,13 +4009,14 @@ client_connect_cb (void *cls,
3974 struct GNUNET_MQ_Handle *mq) 4009 struct GNUNET_MQ_Handle *mq)
3975{ 4010{
3976 struct ClientContext *cli_ctx; 4011 struct ClientContext *cli_ctx;
4012 (void) cls;
3977 4013
3978 LOG (GNUNET_ERROR_TYPE_DEBUG, 4014 LOG (GNUNET_ERROR_TYPE_DEBUG,
3979 "Client connected\n"); 4015 "Client connected\n");
3980 if (NULL == client) 4016 if (NULL == client)
3981 return client; /* Server was destroyed before a client connected. Shutting down */ 4017 return client; /* Server was destroyed before a client connected. Shutting down */
3982 cli_ctx = GNUNET_new (struct ClientContext); 4018 cli_ctx = GNUNET_new (struct ClientContext);
3983 cli_ctx->mq = GNUNET_SERVICE_client_get_mq (client); 4019 cli_ctx->mq = mq;
3984 cli_ctx->view_updates_left = -1; 4020 cli_ctx->view_updates_left = -1;
3985 cli_ctx->client = client; 4021 cli_ctx->client = client;
3986 GNUNET_CONTAINER_DLL_insert (cli_ctx_head, 4022 GNUNET_CONTAINER_DLL_insert (cli_ctx_head,