* TODO:
* - conversion of private to public records does NOT check if the
* records are actually public
- * - need to watch for client disconnects and abort operations on
- * disconnect
*/
#include "platform.h"
#include "gnunet_util_lib.h"
GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr);
clh = GNUNET_new (struct ClientLookupHandle);
+ GNUNET_SERVER_client_set_user_context (client, clh);
GNUNET_CONTAINER_DLL_insert (clh_head, clh_tail, clh);
clh->client = client;
clh->request_id = sh_msg->id;
}
+/**
+ * One of our clients disconnected, clean up after it.
+ *
+ * @param cls NULL
+ * @param client the client that disconnected
+ */
+static void
+notify_client_disconnect (void *cls,
+ struct GNUNET_SERVER_Client *client)
+{
+ struct ClientLookupHandle *clh;
+
+ if (NULL == client)
+ return;
+ clh = GNUNET_SERVER_client_get_user_context (client, struct ClientLookupHandle);
+ if (NULL == clh)
+ return;
+ GNS_resolver_lookup_cancel (clh->lookup);
+ GNUNET_CONTAINER_DLL_remove (clh_head, clh_tail, clh);
+ GNUNET_free (clh);
+}
+
+
/**
* Process GNS requests.
*
GNS_resolver_init (namestore_handle, dht_handle,
c,
max_parallel_bg_queries);
-
- /* Schedule periodic put for our records. */
+ GNUNET_SERVER_disconnect_notify (server,
+ ¬ify_client_disconnect,
+ NULL);
+ /* Schedule periodic put for our records. */
first_zone_iteration = GNUNET_YES;
GNUNET_SERVER_add_handlers (server, handlers);
statistics = GNUNET_STATISTICS_create ("gns", c);