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 /src/curl | |
parent | 95f9076a2139f5fb042b944a0658b6cda2fa35db (diff) | |
download | gnunet-450bdaeaf612aa7717c23390239804bb28b7870f.tar.gz gnunet-450bdaeaf612aa7717c23390239804bb28b7870f.zip |
API update to fix #4479
Diffstat (limited to 'src/curl')
-rw-r--r-- | src/curl/curl.c | 18 |
1 files changed, 17 insertions, 1 deletions
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 | ||