aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-02 00:23:27 +0000
committerChristian Grothoff <christian@grothoff.org>2016-05-02 00:23:27 +0000
commit450bdaeaf612aa7717c23390239804bb28b7870f (patch)
treea0c82385507f1e0dfab9b2bb6a6318cd8c780d08
parent95f9076a2139f5fb042b944a0658b6cda2fa35db (diff)
downloadgnunet-450bdaeaf612aa7717c23390239804bb28b7870f.tar.gz
gnunet-450bdaeaf612aa7717c23390239804bb28b7870f.zip
API update to fix #4479
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/curl/curl.c18
-rw-r--r--src/include/gnunet_curl_lib.h17
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
429src/util/crypto_rsa.c 429src/util/crypto_rsa.c
430src/util/crypto_symmetric.c 430src/util/crypto_symmetric.c
431src/util/disk.c 431src/util/disk.c
432src/util/disk_iterator.c
433src/util/getopt.c 432src/util/getopt.c
434src/util/getopt_helpers.c 433src/util/getopt_helpers.c
435src/util/gnunet-config.c 434src/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 */
171struct GNUNET_CURL_Context * 183struct GNUNET_CURL_Context *
172GNUNET_CURL_init () 184GNUNET_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 */
48typedef 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 */
46struct GNUNET_CURL_Context * 60struct GNUNET_CURL_Context *
47GNUNET_CURL_init (void); 61GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb,
62 void *cb_cls);
48 63
49 64
50/** 65/**