/*
This file is part of GNUnet.
- Copyright (C) 2009-2013, 2016 GNUnet e.V.
+ Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
#include "gnunet_protocols.h"
#include "gnunet_dht_service.h"
#include "gns.h"
-#include "gnunet_gns_service.h"
+#include "gns_api.h"
#define LOG(kind,...) GNUNET_log_from (kind, "gns-api",__VA_ARGS__)
};
-/**
- * Connection to the GNS service.
- */
-struct GNUNET_GNS_Handle
-{
-
- /**
- * Configuration to use.
- */
- const struct GNUNET_CONFIGURATION_Handle *cfg;
-
- /**
- * Connection to service (if available).
- */
- struct GNUNET_MQ_Handle *mq;
-
- /**
- * Head of linked list of active lookup requests.
- */
- struct GNUNET_GNS_LookupRequest *lookup_head;
-
- /**
- * Tail of linked list of active lookup requests.
- */
- struct GNUNET_GNS_LookupRequest *lookup_tail;
-
- /**
- * Reconnect task
- */
- struct GNUNET_SCHEDULER_Task *reconnect_task;
-
- /**
- * How long do we wait until we try to reconnect?
- */
- struct GNUNET_TIME_Relative reconnect_backoff;
-
- /**
- * Request Id generator. Incremented by one for each request.
- */
- uint32_t r_id_gen;
-
-};
-
-
/**
* Reconnect to GNS service.
*
size_t mlen = ntohs (lookup_msg->header.size) - sizeof (*lookup_msg);
uint32_t rd_count = ntohl (lookup_msg->rd_count);
struct GNUNET_GNSRECORD_Data rd[rd_count];
-
+
+ (void) cls;
if (GNUNET_SYSERR ==
GNUNET_GNSRECORD_records_deserialize (mlen,
(const char*) &lookup_msg[1],
return;
proc = lr->lookup_proc;
proc_cls = lr->proc_cls;
- GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
- handle->lookup_tail,
- lr);
- GNUNET_free (lr);
+
GNUNET_assert (GNUNET_OK ==
GNUNET_GNSRECORD_records_deserialize (mlen,
(const char*) &lookup_msg[1],
proc (proc_cls,
rd_count,
rd);
+ GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
+ handle->lookup_tail,
+ lr);
+ if (NULL != lr->env)
+ GNUNET_MQ_discard (lr->env);
+ GNUNET_free (lr);
}
return lr;
}
+
/* end of gns_api.c */