make GNS cancel APIs return closure, can be convenient
authorChristian Grothoff <christian@grothoff.org>
Thu, 21 Jun 2018 06:25:32 +0000 (08:25 +0200)
committerChristian Grothoff <christian@grothoff.org>
Thu, 21 Jun 2018 06:25:32 +0000 (08:25 +0200)
src/gns/gns_api.c
src/gns/gns_tld_api.c
src/include/gnunet_gns_service.h

index 8264bf715cfdb84f498c057906246ad7c442eaf7..0ec9209da80907e907545c0093663935218d5c9a 100644 (file)
@@ -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;
 }
 
 
index b053aa0c1ec6aa69c2e7a1d0441e43549d535c6f..825b51d060de0aaf73f5686c380f8e4689f062cd 100644 (file)
@@ -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 */
index 13f920937f39c4bf665e1a2061f819d7431076fe..b6fac6111b3a2c2dbc5f3d508f271977fc440dc1 100644 (file)
@@ -150,8 +150,9 @@ GNUNET_GNS_lookup (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);
 
 
@@ -198,8 +199,9 @@ 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);