From 336159b59453619dfc9cad5e860462c594785dd9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 21 Jun 2018 08:25:32 +0200 Subject: make GNS cancel APIs return closure, can be convenient --- src/gns/gns_api.c | 6 +++++- src/gns/gns_tld_api.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gns') 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) * Cancel pending lookup request * * @param lr the lookup request to cancel + * @return closure from the lookup result processor */ -void +void * GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) { struct GNUNET_GNS_Handle *handle = lr->gns_handle; + void *ret; GNUNET_CONTAINER_DLL_remove (handle->lookup_head, handle->lookup_tail, lr); GNUNET_MQ_discard (lr->env); + ret = lr->proc_cls; GNUNET_free (lr); + return ret; } 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, * Cancel pending lookup request * * @param ltr the lookup request to cancel + * @return closure from the lookup result processor */ -void +void * GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr) { + void *ret = ltr->lookup_proc_cls; + if (NULL != ltr->id_op) { GNUNET_IDENTITY_ego_lookup_cancel (ltr->id_op); @@ -333,6 +336,7 @@ GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr) } GNUNET_free (ltr->name); GNUNET_free (ltr); + return ret; } /* end of gns_tld_api.c */ -- cgit v1.2.3