diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-05-02 00:23:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-05-02 00:23:27 +0000 |
commit | 450bdaeaf612aa7717c23390239804bb28b7870f (patch) | |
tree | a0c82385507f1e0dfab9b2bb6a6318cd8c780d08 | |
parent | 95f9076a2139f5fb042b944a0658b6cda2fa35db (diff) | |
download | gnunet-450bdaeaf612aa7717c23390239804bb28b7870f.tar.gz gnunet-450bdaeaf612aa7717c23390239804bb28b7870f.zip |
API update to fix #4479
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/curl/curl.c | 18 | ||||
-rw-r--r-- | src/include/gnunet_curl_lib.h | 17 |
3 files changed, 33 insertions, 3 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index 06d180231..ad6c57a90 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -429,7 +429,6 @@ src/util/crypto_random.c | |||
429 | src/util/crypto_rsa.c | 429 | src/util/crypto_rsa.c |
430 | src/util/crypto_symmetric.c | 430 | src/util/crypto_symmetric.c |
431 | src/util/disk.c | 431 | src/util/disk.c |
432 | src/util/disk_iterator.c | ||
433 | src/util/getopt.c | 432 | src/util/getopt.c |
434 | src/util/getopt_helpers.c | 433 | src/util/getopt_helpers.c |
435 | src/util/gnunet-config.c | 434 | src/util/gnunet-config.c |
diff --git a/src/curl/curl.c b/src/curl/curl.c index 92761989f..ac9eeb4fc 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -159,6 +159,16 @@ struct GNUNET_CURL_Context | |||
159 | */ | 159 | */ |
160 | struct curl_slist *json_header; | 160 | struct curl_slist *json_header; |
161 | 161 | ||
162 | /** | ||
163 | * Function we need to call whenever the event loop's | ||
164 | * socket set changed. | ||
165 | */ | ||
166 | GNUNET_CURL_RescheduleCallback cb; | ||
167 | |||
168 | /** | ||
169 | * Closure for @e cb. | ||
170 | */ | ||
171 | void *cb_cls; | ||
162 | }; | 172 | }; |
163 | 173 | ||
164 | 174 | ||
@@ -166,10 +176,13 @@ struct GNUNET_CURL_Context | |||
166 | * Initialise this library. This function should be called before using any of | 176 | * Initialise this library. This function should be called before using any of |
167 | * the following functions. | 177 | * the following functions. |
168 | * | 178 | * |
179 | * @param cb function to call when rescheduling is required | ||
180 | * @param cb_cls closure for @a cb | ||
169 | * @return library context | 181 | * @return library context |
170 | */ | 182 | */ |
171 | struct GNUNET_CURL_Context * | 183 | struct GNUNET_CURL_Context * |
172 | GNUNET_CURL_init () | 184 | GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, |
185 | void *cb_cls) | ||
173 | { | 186 | { |
174 | struct GNUNET_CURL_Context *ctx; | 187 | struct GNUNET_CURL_Context *ctx; |
175 | CURLM *multi; | 188 | CURLM *multi; |
@@ -194,6 +207,8 @@ GNUNET_CURL_init () | |||
194 | return NULL; | 207 | return NULL; |
195 | } | 208 | } |
196 | ctx = GNUNET_new (struct GNUNET_CURL_Context); | 209 | ctx = GNUNET_new (struct GNUNET_CURL_Context); |
210 | ctx->cb = cb; | ||
211 | ctx->cb_cls = cb_cls; | ||
197 | ctx->multi = multi; | 212 | ctx->multi = multi; |
198 | ctx->share = share; | 213 | ctx->share = share; |
199 | GNUNET_assert (NULL != (ctx->json_header = | 214 | GNUNET_assert (NULL != (ctx->json_header = |
@@ -316,6 +331,7 @@ GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx, | |||
316 | GNUNET_CONTAINER_DLL_insert (ctx->jobs_head, | 331 | GNUNET_CONTAINER_DLL_insert (ctx->jobs_head, |
317 | ctx->jobs_tail, | 332 | ctx->jobs_tail, |
318 | job); | 333 | job); |
334 | ctx->cb (ctx->cb_cls); | ||
319 | return job; | 335 | return job; |
320 | } | 336 | } |
321 | 337 | ||
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index faa7abbed..c57b9ed3b 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h | |||
@@ -38,13 +38,28 @@ | |||
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Function called by the context to ask for the event loop to be | ||
42 | * rescheduled, that is the application should call | ||
43 | * #GNUNET_CURL_get_select_info() as the set of sockets we care about | ||
44 | * just changed. | ||
45 | * | ||
46 | * @param cls closure | ||
47 | */ | ||
48 | typedef void | ||
49 | (*GNUNET_CURL_RescheduleCallback)(void *cls); | ||
50 | |||
51 | |||
52 | /** | ||
41 | * Initialise this library. This function should be called before using any of | 53 | * Initialise this library. This function should be called before using any of |
42 | * the following functions. | 54 | * the following functions. |
43 | * | 55 | * |
56 | * @param cb function to call when rescheduling is required | ||
57 | * @param cb_cls closure for @a cb | ||
44 | * @return library context | 58 | * @return library context |
45 | */ | 59 | */ |
46 | struct GNUNET_CURL_Context * | 60 | struct GNUNET_CURL_Context * |
47 | GNUNET_CURL_init (void); | 61 | GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, |
62 | void *cb_cls); | ||
48 | 63 | ||
49 | 64 | ||
50 | /** | 65 | /** |