*/
static struct GNUNET_NAMESTORE_QueueEntry *add_qe;
+/**
+ * Queue entry for the 'add-uri' operation.
+ */
+static struct GNUNET_NAMESTORE_QueueEntry *add_qe_uri;
+
/**
* Desired action is to list records.
*/
do_shutdown (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ if (NULL != list_it)
+ {
+ GNUNET_NAMESTORE_zone_iteration_stop (list_it);
+ list_it = NULL;
+ }
+ if (NULL != add_qe)
+ {
+ GNUNET_NAMESTORE_cancel (add_qe);
+ add_qe = NULL;
+ }
+ if (NULL != add_qe_uri)
+ {
+ GNUNET_NAMESTORE_cancel (add_qe_uri);
+ add_qe_uri = NULL;
+ }
+ if (NULL != del_qe)
+ {
+ GNUNET_NAMESTORE_cancel (del_qe);
+ del_qe = NULL;
+ }
if (NULL != ns)
{
GNUNET_NAMESTORE_disconnect (ns);
* Continuation called to notify client about result of the
* operation.
*
- * @param cls closure, unused
+ * @param cls closure, location of the QueueEntry pointer to NULL out
* @param success GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
* GNUNET_NO if content was already there
* GNUNET_YES (or other positive value) on success
int32_t success,
const char *emsg)
{
- add_qe = NULL;
+ struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
+
+ *qe = NULL;
if (GNUNET_YES != success)
{
fprintf (stderr,
if (GNUNET_NO != success)
ret = 1;
}
- if ( (NULL == del_qe) &&
+ if ( (NULL == add_qe) &&
+ (NULL == add_qe_uri) &&
+ (NULL == del_qe) &&
(NULL == list_it) )
GNUNET_SCHEDULER_shutdown ();
}
_("Deleting record failed: %s\n"),
emsg);
if ( (NULL == add_qe) &&
+ (NULL == add_qe_uri) &&
(NULL == list_it) )
GNUNET_SCHEDULER_shutdown ();
}
const char *typestring;
char *s;
unsigned int i;
+ char *etime;
+ struct GNUNET_TIME_Absolute aex;
+ struct GNUNET_TIME_Relative rex;
if (NULL == name)
{
list_it = NULL;
if ( (NULL == del_qe) &&
+ (NULL == add_qe_uri) &&
(NULL == add_qe) )
GNUNET_SCHEDULER_shutdown ();
return;
(unsigned int) rd[i].record_type);
continue;
}
- FPRINTF (stdout, "\t%s: %s\n", typestring, s);
+ if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+ {
+ rex.rel_value = rd[i].expiration_time;
+ etime = GNUNET_STRINGS_relative_time_to_string (rex);
+ }
+ else
+ {
+ aex.abs_value = rd[i].expiration_time;
+ etime = GNUNET_STRINGS_absolute_time_to_string (aex);
+ }
+ FPRINTF (stdout, "\t%s: %s (%s %s)\n", typestring, s,
+ (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+ ? _(/* what follows is relative expiration */ "for at least")
+ : _(/* what follows is absolute expiration */ "until"),
+ etime);
+ GNUNET_free (etime);
GNUNET_free (s);
}
FPRINTF (stdout, "%s", "\n");
ret = 1;
return;
}
+ memset (&rd, 0, sizeof (rd));
if (add)
{
if (NULL == name)
name,
&rd,
&add_continuation,
- NULL);
+ &add_qe);
}
if (del)
{
list_it = GNUNET_NAMESTORE_zone_iteration_start (ns,
&zone,
- 0,
+ GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION,
must_not_flags,
&display_record,
NULL);
if (1 != nonauthority)
rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY;
- add_qe = GNUNET_NAMESTORE_record_create (ns,
- zone_pkey,
- name,
- &rd,
- &add_continuation,
- NULL);
+ add_qe_uri = GNUNET_NAMESTORE_record_create (ns,
+ zone_pkey,
+ name,
+ &rd,
+ &add_continuation,
+ &add_qe_uri);
}
GNUNET_free_non_null (data);
}