aboutsummaryrefslogtreecommitdiff
path: root/src/identity
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
commit29e6158507a0758192075ac6ece7ba8e75ddc49a (patch)
treeb91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/identity
parent5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff)
downloadgnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz
gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/identity')
-rw-r--r--src/identity/gnunet-identity.c4
-rw-r--r--src/identity/gnunet-service-identity.c3
-rw-r--r--src/identity/identity_api.c7
-rw-r--r--src/identity/plugin_rest_identity.c24
-rw-r--r--src/identity/test_identity.c6
-rw-r--r--src/identity/test_identity_defaults.c6
6 files changed, 19 insertions, 31 deletions
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 574586b40..dc9174d21 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -84,11 +84,9 @@ static struct GNUNET_IDENTITY_Operation *delete_op;
84 * Task run on shutdown. 84 * Task run on shutdown.
85 * 85 *
86 * @param cls NULL 86 * @param cls NULL
87 * @param tc unused
88 */ 87 */
89static void 88static void
90shutdown_task (void *cls, 89shutdown_task (void *cls)
91 const struct GNUNET_SCHEDULER_TaskContext *tc)
92{ 90{
93 if (NULL != set_op) 91 if (NULL != set_op)
94 { 92 {
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index 8a26fb8c3..d36319a99 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -134,10 +134,9 @@ get_ego_filename (struct Ego *ego)
134 * Task run during shutdown. 134 * Task run during shutdown.
135 * 135 *
136 * @param cls unused 136 * @param cls unused
137 * @param tc unused
138 */ 137 */
139static void 138static void
140shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 139shutdown_task (void *cls)
141{ 140{
142 struct Ego *e; 141 struct Ego *e;
143 142
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 6b7ca5c44..1406ddd41 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -195,11 +195,9 @@ GNUNET_IDENTITY_ego_get_anonymous ()
195 * Try again to connect to the identity service. 195 * Try again to connect to the identity service.
196 * 196 *
197 * @param cls handle to the identity service. 197 * @param cls handle to the identity service.
198 * @param tc scheduler context
199 */ 198 */
200static void 199static void
201reconnect (void *cls, 200reconnect (void *cls);
202 const struct GNUNET_SCHEDULER_TaskContext *tc);
203 201
204 202
205/** 203/**
@@ -533,10 +531,9 @@ transmit_next (struct GNUNET_IDENTITY_Handle *h)
533 * Try again to connect to the identity service. 531 * Try again to connect to the identity service.
534 * 532 *
535 * @param cls handle to the identity service. 533 * @param cls handle to the identity service.
536 * @param tc scheduler context
537 */ 534 */
538static void 535static void
539reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 536reconnect (void *cls)
540{ 537{
541 struct GNUNET_IDENTITY_Handle *h = cls; 538 struct GNUNET_IDENTITY_Handle *h = cls;
542 struct GNUNET_IDENTITY_Operation *op; 539 struct GNUNET_IDENTITY_Operation *op;
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index 9ab3a8772..22ade6a0e 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -107,12 +107,12 @@ struct EgoEntry
107 * DLL 107 * DLL
108 */ 108 */
109 struct EgoEntry *next; 109 struct EgoEntry *next;
110 110
111 /** 111 /**
112 * DLL 112 * DLL
113 */ 113 */
114 struct EgoEntry *prev; 114 struct EgoEntry *prev;
115 115
116 /** 116 /**
117 * Ego Identifier 117 * Ego Identifier
118 */ 118 */
@@ -122,7 +122,7 @@ struct EgoEntry
122 * Public key string 122 * Public key string
123 */ 123 */
124 char *keystring; 124 char *keystring;
125 125
126 /** 126 /**
127 * The Ego 127 * The Ego
128 */ 128 */
@@ -146,7 +146,7 @@ struct RequestHandle
146 * Handle to the rest connection 146 * Handle to the rest connection
147 */ 147 */
148 struct RestConnectionDataHandle *conndata_handle; 148 struct RestConnectionDataHandle *conndata_handle;
149 149
150 /** 150 /**
151 * The processing state 151 * The processing state
152 */ 152 */
@@ -170,7 +170,7 @@ struct RequestHandle
170 /** 170 /**
171 * ID of a task associated with the resolution process. 171 * ID of a task associated with the resolution process.
172 */ 172 */
173 struct GNUNET_SCHEDULER_Task * timeout_task; 173 struct GNUNET_SCHEDULER_Task * timeout_task;
174 174
175 /** 175 /**
176 * The plugin result processor 176 * The plugin result processor
@@ -260,11 +260,9 @@ cleanup_handle (struct RequestHandle *handle)
260 * Task run on shutdown. Cleans up everything. 260 * Task run on shutdown. Cleans up everything.
261 * 261 *
262 * @param cls unused 262 * @param cls unused
263 * @param tc scheduler context
264 */ 263 */
265static void 264static void
266do_error (void *cls, 265do_error (void *cls)
267 const struct GNUNET_SCHEDULER_TaskContext *tc)
268{ 266{
269 struct RequestHandle *handle = cls; 267 struct RequestHandle *handle = cls;
270 struct MHD_Response *resp; 268 struct MHD_Response *resp;
@@ -528,7 +526,7 @@ ego_create_cont (struct RestConnectionDataHandle *con,
528 egoname_json = GNUNET_REST_jsonapi_resource_read_attr (json_res, GNUNET_REST_JSONAPI_IDENTITY_NAME); 526 egoname_json = GNUNET_REST_jsonapi_resource_read_attr (json_res, GNUNET_REST_JSONAPI_IDENTITY_NAME);
529 if (!json_is_string (egoname_json)) 527 if (!json_is_string (egoname_json))
530 { 528 {
531 GNUNET_REST_jsonapi_object_delete (json_obj); 529 GNUNET_REST_jsonapi_object_delete (json_obj);
532 handle->emsg = GNUNET_strdup ("No name provided"); 530 handle->emsg = GNUNET_strdup ("No name provided");
533 GNUNET_SCHEDULER_add_now (&do_error, handle); 531 GNUNET_SCHEDULER_add_now (&do_error, handle);
534 return; 532 return;
@@ -563,7 +561,7 @@ ego_create_cont (struct RestConnectionDataHandle *con,
563 * @param url the url that is requested 561 * @param url the url that is requested
564 * @param cls the RequestHandle 562 * @param cls the RequestHandle
565 */ 563 */
566static void 564static void
567ego_edit_cont (struct RestConnectionDataHandle *con, 565ego_edit_cont (struct RestConnectionDataHandle *con,
568 const char *url, 566 const char *url,
569 void *cls) 567 void *cls)
@@ -633,7 +631,7 @@ ego_edit_cont (struct RestConnectionDataHandle *con,
633 GNUNET_SCHEDULER_add_now (&do_error, handle); 631 GNUNET_SCHEDULER_add_now (&do_error, handle);
634 return; 632 return;
635 } 633 }
636 json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0); 634 json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0);
637 635
638 if (GNUNET_NO == GNUNET_REST_jsonapi_resource_check_type (json_res, GNUNET_REST_JSONAPI_IDENTITY_EGO)) 636 if (GNUNET_NO == GNUNET_REST_jsonapi_resource_check_type (json_res, GNUNET_REST_JSONAPI_IDENTITY_EGO))
639 { 637 {
@@ -692,7 +690,7 @@ ego_edit_cont (struct RestConnectionDataHandle *con,
692 GNUNET_SCHEDULER_add_now (&do_error, handle); 690 GNUNET_SCHEDULER_add_now (&do_error, handle);
693} 691}
694 692
695void 693void
696ego_delete_cont (struct RestConnectionDataHandle *con_handle, 694ego_delete_cont (struct RestConnectionDataHandle *con_handle,
697 const char* url, 695 const char* url,
698 void *cls) 696 void *cls)
@@ -836,7 +834,7 @@ list_ego (void *cls,
836 if (ID_REST_STATE_INIT == handle->state) { 834 if (ID_REST_STATE_INIT == handle->state) {
837 ego_entry = GNUNET_new (struct EgoEntry); 835 ego_entry = GNUNET_new (struct EgoEntry);
838 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 836 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
839 ego_entry->keystring = 837 ego_entry->keystring =
840 GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 838 GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
841 ego_entry->ego = ego; 839 ego_entry->ego = ego;
842 GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); 840 GNUNET_asprintf (&ego_entry->identifier, "%s", identifier);
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c
index 12d182c65..6eaa86e91 100644
--- a/src/identity/test_identity.c
+++ b/src/identity/test_identity.c
@@ -77,10 +77,9 @@ cleanup ()
77 * Termiante the testcase (failure). 77 * Termiante the testcase (failure).
78 * 78 *
79 * @param cls NULL 79 * @param cls NULL
80 * @param tc scheduler context
81 */ 80 */
82static void 81static void
83endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 82endbadly (void *cls)
84{ 83{
85 cleanup (); 84 cleanup ();
86 res = 1; 85 res = 1;
@@ -91,10 +90,9 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
91 * Termiante the testcase (success). 90 * Termiante the testcase (success).
92 * 91 *
93 * @param cls NULL 92 * @param cls NULL
94 * @param tc scheduler context
95 */ 93 */
96static void 94static void
97end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 95end_normally (void *cls)
98{ 96{
99 cleanup (); 97 cleanup ();
100 res = 0; 98 res = 0;
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c
index 961066627..207db321f 100644
--- a/src/identity/test_identity_defaults.c
+++ b/src/identity/test_identity_defaults.c
@@ -77,10 +77,9 @@ cleanup ()
77 * Termiante the testcase (failure). 77 * Termiante the testcase (failure).
78 * 78 *
79 * @param cls NULL 79 * @param cls NULL
80 * @param tc scheduler context
81 */ 80 */
82static void 81static void
83endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 82endbadly (void *cls)
84{ 83{
85 cleanup (); 84 cleanup ();
86 res = 1; 85 res = 1;
@@ -91,10 +90,9 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
91 * Termiante the testcase (success). 90 * Termiante the testcase (success).
92 * 91 *
93 * @param cls NULL 92 * @param cls NULL
94 * @param tc scheduler context
95 */ 93 */
96static void 94static void
97end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 95end_normally (void *cls)
98{ 96{
99 cleanup (); 97 cleanup ();
100 res = 0; 98 res = 0;