aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-21 08:25:32 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-21 08:25:32 +0200
commit336159b59453619dfc9cad5e860462c594785dd9 (patch)
treeee1452c1f1f18f44365a8a4b541280c9d963e4fc /src
parent4c7eae3c88bed613fb365920812dc60e0e364ee4 (diff)
downloadgnunet-336159b59453619dfc9cad5e860462c594785dd9.tar.gz
gnunet-336159b59453619dfc9cad5e860462c594785dd9.zip
make GNS cancel APIs return closure, can be convenient
Diffstat (limited to 'src')
-rw-r--r--src/gns/gns_api.c6
-rw-r--r--src/gns/gns_tld_api.c6
-rw-r--r--src/include/gnunet_gns_service.h6
3 files changed, 14 insertions, 4 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 8264bf715..0ec9209da 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -300,17 +300,21 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle)
300 * Cancel pending lookup request 300 * Cancel pending lookup request
301 * 301 *
302 * @param lr the lookup request to cancel 302 * @param lr the lookup request to cancel
303 * @return closure from the lookup result processor
303 */ 304 */
304void 305void *
305GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) 306GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr)
306{ 307{
307 struct GNUNET_GNS_Handle *handle = lr->gns_handle; 308 struct GNUNET_GNS_Handle *handle = lr->gns_handle;
309 void *ret;
308 310
309 GNUNET_CONTAINER_DLL_remove (handle->lookup_head, 311 GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
310 handle->lookup_tail, 312 handle->lookup_tail,
311 lr); 313 lr);
312 GNUNET_MQ_discard (lr->env); 314 GNUNET_MQ_discard (lr->env);
315 ret = lr->proc_cls;
313 GNUNET_free (lr); 316 GNUNET_free (lr);
317 return ret;
314} 318}
315 319
316 320
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index b053aa0c1..825b51d06 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -317,10 +317,13 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
317 * Cancel pending lookup request 317 * Cancel pending lookup request
318 * 318 *
319 * @param ltr the lookup request to cancel 319 * @param ltr the lookup request to cancel
320 * @return closure from the lookup result processor
320 */ 321 */
321void 322void *
322GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr) 323GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr)
323{ 324{
325 void *ret = ltr->lookup_proc_cls;
326
324 if (NULL != ltr->id_op) 327 if (NULL != ltr->id_op)
325 { 328 {
326 GNUNET_IDENTITY_ego_lookup_cancel (ltr->id_op); 329 GNUNET_IDENTITY_ego_lookup_cancel (ltr->id_op);
@@ -333,6 +336,7 @@ GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr)
333 } 336 }
334 GNUNET_free (ltr->name); 337 GNUNET_free (ltr->name);
335 GNUNET_free (ltr); 338 GNUNET_free (ltr);
339 return ret;
336} 340}
337 341
338/* end of gns_tld_api.c */ 342/* end of gns_tld_api.c */
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 13f920937..b6fac6111 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -150,8 +150,9 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
150 * Cancel pending lookup request 150 * Cancel pending lookup request
151 * 151 *
152 * @param lr the lookup request to cancel 152 * @param lr the lookup request to cancel
153 * @return closure from the lookup result processor
153 */ 154 */
154void 155void *
155GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr); 156GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr);
156 157
157 158
@@ -198,8 +199,9 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
198 * Cancel pending lookup request 199 * Cancel pending lookup request
199 * 200 *
200 * @param ltr the lookup request to cancel 201 * @param ltr the lookup request to cancel
202 * @return closure from the lookup result processor
201 */ 203 */
202void 204void *
203GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr); 205GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr);
204 206
205 207