diff options
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-rps.c | 4 | ||||
-rw-r--r-- | src/rps/gnunet-service-rps.c | 12 | ||||
-rw-r--r-- | src/rps/gnunet-service-rps_sampler.c | 20 | ||||
-rw-r--r-- | src/rps/test_rps.c | 32 |
4 files changed, 32 insertions, 36 deletions
diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c index 23516b626..01be2aeb3 100644 --- a/src/rps/gnunet-rps.c +++ b/src/rps/gnunet-rps.c | |||
@@ -92,11 +92,9 @@ GNUNET_GETOPT_set_peerid (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
92 | * Cancels pending request and disconnects. | 92 | * Cancels pending request and disconnects. |
93 | * | 93 | * |
94 | * @param cls NULL | 94 | * @param cls NULL |
95 | * @param tc scheduler context | ||
96 | */ | 95 | */ |
97 | static void | 96 | static void |
98 | do_shutdown (void *cls, | 97 | do_shutdown (void *cls) |
99 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
100 | { | 98 | { |
101 | shutdown_task = NULL; | 99 | shutdown_task = NULL; |
102 | if (NULL != req_handle) | 100 | if (NULL != req_handle) |
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index e3ddb4bff..af06cf1bd 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1482,10 +1482,10 @@ send_push (const struct GNUNET_PeerIdentity *peer_id) | |||
1482 | 1482 | ||
1483 | 1483 | ||
1484 | static void | 1484 | static void |
1485 | do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 1485 | do_round (void *cls); |
1486 | 1486 | ||
1487 | static void | 1487 | static void |
1488 | do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 1488 | do_mal_round (void *cls); |
1489 | 1489 | ||
1490 | 1490 | ||
1491 | #ifdef ENABLE_MALICIOUS | 1491 | #ifdef ENABLE_MALICIOUS |
@@ -1624,7 +1624,7 @@ handle_client_act_malicious (void *cls, | |||
1624 | * This is executed regylary. | 1624 | * This is executed regylary. |
1625 | */ | 1625 | */ |
1626 | static void | 1626 | static void |
1627 | do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1627 | do_mal_round (void *cls) |
1628 | { | 1628 | { |
1629 | uint32_t num_pushes; | 1629 | uint32_t num_pushes; |
1630 | uint32_t i; | 1630 | uint32_t i; |
@@ -1756,7 +1756,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1756 | * This is executed regylary. | 1756 | * This is executed regylary. |
1757 | */ | 1757 | */ |
1758 | static void | 1758 | static void |
1759 | do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1759 | do_round (void *cls) |
1760 | { | 1760 | { |
1761 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round.\n"); | 1761 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round.\n"); |
1762 | 1762 | ||
@@ -2032,11 +2032,9 @@ process_peerinfo_peers (void *cls, | |||
2032 | * Task run during shutdown. | 2032 | * Task run during shutdown. |
2033 | * | 2033 | * |
2034 | * @param cls unused | 2034 | * @param cls unused |
2035 | * @param tc unused | ||
2036 | */ | 2035 | */ |
2037 | static void | 2036 | static void |
2038 | shutdown_task (void *cls, | 2037 | shutdown_task (void *cls) |
2039 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
2040 | { | 2038 | { |
2041 | 2039 | ||
2042 | LOG (GNUNET_ERROR_TYPE_DEBUG, "RPS is going down\n"); | 2040 | LOG (GNUNET_ERROR_TYPE_DEBUG, "RPS is going down\n"); |
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c index b65dd7c47..e5f6595bb 100644 --- a/src/rps/gnunet-service-rps_sampler.c +++ b/src/rps/gnunet-service-rps_sampler.c | |||
@@ -107,8 +107,7 @@ struct GetPeerCls | |||
107 | * Sampler. | 107 | * Sampler. |
108 | */ | 108 | */ |
109 | typedef void | 109 | typedef void |
110 | (*RPS_get_peers_type) (void *cls, | 110 | (*RPS_get_peers_type) (void *cls); |
111 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
112 | 111 | ||
113 | /** | 112 | /** |
114 | * Get one random peer out of the sampled peers. | 113 | * Get one random peer out of the sampled peers. |
@@ -118,8 +117,8 @@ typedef void | |||
118 | * Only used internally | 117 | * Only used internally |
119 | */ | 118 | */ |
120 | static void | 119 | static void |
121 | sampler_get_rand_peer (void *cls, | 120 | sampler_get_rand_peer (void *cls); |
122 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 121 | |
123 | 122 | ||
124 | /** | 123 | /** |
125 | * Get one random peer out of the sampled peers. | 124 | * Get one random peer out of the sampled peers. |
@@ -128,8 +127,7 @@ sampler_get_rand_peer (void *cls, | |||
128 | * corrsponding peer to the client. | 127 | * corrsponding peer to the client. |
129 | */ | 128 | */ |
130 | static void | 129 | static void |
131 | sampler_mod_get_rand_peer (void *cls, | 130 | sampler_mod_get_rand_peer (void *cls); |
132 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
133 | 131 | ||
134 | 132 | ||
135 | /** | 133 | /** |
@@ -530,14 +528,15 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler, | |||
530 | * Only used internally | 528 | * Only used internally |
531 | */ | 529 | */ |
532 | static void | 530 | static void |
533 | sampler_get_rand_peer (void *cls, | 531 | sampler_get_rand_peer (void *cls) |
534 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
535 | { | 532 | { |
536 | struct GetPeerCls *gpc = cls; | 533 | struct GetPeerCls *gpc = cls; |
537 | uint32_t r_index; | 534 | uint32_t r_index; |
538 | struct RPS_Sampler *sampler; | 535 | struct RPS_Sampler *sampler; |
536 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
539 | 537 | ||
540 | gpc->get_peer_task = NULL; | 538 | gpc->get_peer_task = NULL; |
539 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
541 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 540 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
542 | return; | 541 | return; |
543 | sampler = gpc->req_handle->sampler; | 542 | sampler = gpc->req_handle->sampler; |
@@ -583,15 +582,16 @@ sampler_get_rand_peer (void *cls, | |||
583 | * corrsponding peer to the client. | 582 | * corrsponding peer to the client. |
584 | */ | 583 | */ |
585 | static void | 584 | static void |
586 | sampler_mod_get_rand_peer (void *cls, | 585 | sampler_mod_get_rand_peer (void *cls) |
587 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
588 | { | 586 | { |
589 | struct GetPeerCls *gpc = cls; | 587 | struct GetPeerCls *gpc = cls; |
590 | struct RPS_SamplerElement *s_elem; | 588 | struct RPS_SamplerElement *s_elem; |
591 | struct GNUNET_TIME_Relative last_request_diff; | 589 | struct GNUNET_TIME_Relative last_request_diff; |
592 | struct RPS_Sampler *sampler; | 590 | struct RPS_Sampler *sampler; |
591 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
593 | 592 | ||
594 | gpc->get_peer_task = NULL; | 593 | gpc->get_peer_task = NULL; |
594 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
595 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 595 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
596 | return; | 596 | return; |
597 | sampler = gpc->req_handle->sampler; | 597 | sampler = gpc->req_handle->sampler; |
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 63eb8417a..aca58d55e 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -430,7 +430,7 @@ tofile_ (const char *file_name, char *line) | |||
430 | 430 | ||
431 | 431 | ||
432 | /** | 432 | /** |
433 | * Write the ids and their according index in the given array to a file | 433 | * Write the ids and their according index in the given array to a file |
434 | * Unused | 434 | * Unused |
435 | */ | 435 | */ |
436 | /* static void | 436 | /* static void |
@@ -493,7 +493,7 @@ make_oplist_entry () | |||
493 | * Task run on timeout to shut everything down. | 493 | * Task run on timeout to shut everything down. |
494 | */ | 494 | */ |
495 | static void | 495 | static void |
496 | shutdown_op (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 496 | shutdown_op (void *cls) |
497 | { | 497 | { |
498 | unsigned int i; | 498 | unsigned int i; |
499 | 499 | ||
@@ -513,11 +513,11 @@ shutdown_op (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
513 | /** | 513 | /** |
514 | * Seed peers. | 514 | * Seed peers. |
515 | */ | 515 | */ |
516 | void | 516 | static void |
517 | seed_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 517 | seed_peers (void *cls) |
518 | { | 518 | { |
519 | struct RPSPeer *peer = cls; | ||
519 | unsigned int amount; | 520 | unsigned int amount; |
520 | struct RPSPeer *peer = (struct RPSPeer *) cls; | ||
521 | unsigned int i; | 521 | unsigned int i; |
522 | 522 | ||
523 | // TODO if malicious don't seed mal peers | 523 | // TODO if malicious don't seed mal peers |
@@ -532,13 +532,14 @@ seed_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
532 | GNUNET_RPS_seed_ids (peer->rps_handle, amount, rps_peer_ids); | 532 | GNUNET_RPS_seed_ids (peer->rps_handle, amount, rps_peer_ids); |
533 | } | 533 | } |
534 | 534 | ||
535 | |||
535 | /** | 536 | /** |
536 | * Seed peers. | 537 | * Seed peers. |
537 | */ | 538 | */ |
538 | void | 539 | static void |
539 | seed_peers_big (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 540 | seed_peers_big (void *cls) |
540 | { | 541 | { |
541 | struct RPSPeer *peer = (struct RPSPeer *) cls; | 542 | struct RPSPeer *peer = cls; |
542 | unsigned int seed_msg_size; | 543 | unsigned int seed_msg_size; |
543 | uint32_t num_peers_max; | 544 | uint32_t num_peers_max; |
544 | unsigned int amount; | 545 | unsigned int amount; |
@@ -740,7 +741,7 @@ default_reply_handle (void *cls, | |||
740 | "[%s] got %" PRIu64 " peers:\n", | 741 | "[%s] got %" PRIu64 " peers:\n", |
741 | GNUNET_i2s (rps_peer->peer_id), | 742 | GNUNET_i2s (rps_peer->peer_id), |
742 | n); | 743 | n); |
743 | 744 | ||
744 | for (i = 0; i < n; i++) | 745 | for (i = 0; i < n; i++) |
745 | { | 746 | { |
746 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 747 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -762,11 +763,10 @@ default_reply_handle (void *cls, | |||
762 | * Request random peers. | 763 | * Request random peers. |
763 | */ | 764 | */ |
764 | static void | 765 | static void |
765 | request_peers (void *cls, | 766 | request_peers (void *cls) |
766 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
767 | { | 767 | { |
768 | struct PendingRequest *pending_req = cls; | ||
768 | struct RPSPeer *rps_peer; | 769 | struct RPSPeer *rps_peer; |
769 | struct PendingRequest *pending_req = (struct PendingRequest *) cls; | ||
770 | struct PendingReply *pending_rep; | 770 | struct PendingReply *pending_rep; |
771 | 771 | ||
772 | if (GNUNET_YES == in_shutdown) | 772 | if (GNUNET_YES == in_shutdown) |
@@ -827,11 +827,10 @@ cancel_request (struct PendingReply *pending_rep) | |||
827 | * Cancel a request. | 827 | * Cancel a request. |
828 | */ | 828 | */ |
829 | static void | 829 | static void |
830 | cancel_request_cb (void *cls, | 830 | cancel_request_cb (void *cls) |
831 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
832 | { | 831 | { |
832 | struct RPSPeer *rps_peer = cls; | ||
833 | struct PendingReply *pending_rep; | 833 | struct PendingReply *pending_rep; |
834 | struct RPSPeer *rps_peer = (struct RPSPeer *) cls; | ||
835 | 834 | ||
836 | if (GNUNET_YES == in_shutdown) | 835 | if (GNUNET_YES == in_shutdown) |
837 | return; | 836 | return; |
@@ -1137,8 +1136,9 @@ manage_service_wrapper (unsigned int i, unsigned int j, int delta, | |||
1137 | } | 1136 | } |
1138 | } | 1137 | } |
1139 | 1138 | ||
1139 | |||
1140 | static void | 1140 | static void |
1141 | churn (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1141 | churn (void *cls) |
1142 | { | 1142 | { |
1143 | unsigned int i; | 1143 | unsigned int i; |
1144 | unsigned int j; | 1144 | unsigned int j; |