GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
#include "fs.h"
#include "fs_tree.h"
+#define DEBUG_UNINDEX GNUNET_NO
/**
* Function called by the tree encoder to obtain
signal_unindex_error (uc);
return;
}
+#if DEBUG_UNINDEX
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Datastore REMOVE operation succeeded\n");
+#endif
GNUNET_FS_tree_encoder_next (uc->tc);
}
const void *data;
struct OnDemandBlock odb;
- if (type != GNUNET_BLOCK_TYPE_DBLOCK)
+ if (type != GNUNET_BLOCK_TYPE_FS_DBLOCK)
{
size = block_size;
data = block;
odb.file_id = uc->file_id;
data = &odb;
}
+#if DEBUG_UNINDEX
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending REMOVE request to DATASTORE service\n");
+#endif
GNUNET_DATASTORE_remove (uc->dsh,
query,
size,
struct GNUNET_FS_Uri *uri;
struct UnindexMessage req;
+ /* generate final progress message */
+ unindex_progress (uc,
+ uc->file_size,
+ NULL,
+ 0, 0);
GNUNET_FS_tree_encoder_finish (uc->tc,
&uri,
&emsg);
uc->dsh = NULL;
uc->state = UNINDEX_STATE_FS_NOTIFY;
GNUNET_FS_unindex_sync_ (uc);
- uc->client = GNUNET_CLIENT_connect (uc->h->sched,
- "fs",
+ uc->client = GNUNET_CLIENT_connect ("fs",
uc->h->cfg);
+ if (uc->client == NULL)
+ {
+ uc->state = UNINDEX_STATE_ERROR;
+ uc->emsg = GNUNET_strdup (_("Failed to connect to FS service for unindexing."));
+ GNUNET_FS_unindex_sync_ (uc);
+ signal_unindex_error (uc);
+ return;
+ }
+#if DEBUG_UNINDEX
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending UNINDEX message to FS service\n");
+#endif
req.header.size = htons (sizeof (struct UnindexMessage));
req.header.type = htons (GNUNET_MESSAGE_TYPE_FS_UNINDEX);
req.reserved = 0;
void
GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc)
{
- uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg,
- uc->h->sched);
+ uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg);
if (NULL == uc->dsh)
{
uc->state = UNINDEX_STATE_ERROR;
pi.status = GNUNET_FS_STATUS_UNINDEX_START;
pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_FS_unindex_make_status_ (&pi, ret, 0);
- ret->fhc = GNUNET_CRYPTO_hash_file (h->sched,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
+ ret->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE,
filename,
HASHING_BLOCKSIZE,
&GNUNET_FS_unindex_process_hash_,