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 "gnunet_protocols.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
-#include "gnunet-service-fs_drq.h"
#include "gnunet-service-fs_indexing.h"
#include "fs.h"
-#define DEBUG_FS GNUNET_YES
+#define DEBUG_FS GNUNET_NO
/**
* In-memory information about indexed files (also available
*/
static struct GNUNET_CONTAINER_MultiHashMap *ifm;
-/**
- * Our scheduler.
- */
-static struct GNUNET_SCHEDULER_Handle *sched;
-
/**
* Our configuration.
*/
GNUNET_BIO_read_string (rh,
"Name of indexed file",
&fname,
- 1024 * 16)) )
+ 1024 * 16)) &&
+ (fname != NULL) )
{
slen = strlen (fname) + 1;
pos = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
uint16_t msize;
struct IndexInfo *ii;
size_t slen;
- uint32_t dev;
+ uint64_t dev;
uint64_t ino;
- uint32_t mydev;
+ uint64_t mydev;
uint64_t myino;
msize = ntohs(message->size);
}
ism = (const struct IndexStartMessage*) message;
fn = GNUNET_STRINGS_filename_expand ((const char*) &ism[1]);
- dev = ntohl (ism->device);
+ if (fn == NULL)
+ {
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
+ return;
+ }
+ dev = GNUNET_ntohll (ism->device);
ino = GNUNET_ntohll (ism->inode);
ism = (const struct IndexStartMessage*) message;
slen = strlen (fn) + 1;
(unsigned int) mydev);
#endif
/* slow validation, need to hash full file (again) */
- ii->fhc = GNUNET_CRYPTO_hash_file (sched,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
+ ii->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE,
fn,
HASHING_BLOCKSIZE,
&hash_for_index_val,
{
struct GNUNET_SERVER_TransmitContext *tc;
struct IndexInfoMessage *iim;
- char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
size_t slen;
const char *fn;
struct IndexInfo *pos;
{
fn = pos->filename;
slen = strlen (fn) + 1;
- if (slen + sizeof (struct IndexInfoMessage) >
- GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (slen + sizeof (struct IndexInfoMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
break;
key,
nsize,
edata,
- GNUNET_BLOCK_TYPE_DBLOCK,
+ GNUNET_BLOCK_TYPE_FS_DBLOCK,
priority,
anonymity,
expiration,
indexed_files = pos->next;
GNUNET_free (pos);
}
- sched = NULL;
cfg = NULL;
}
/**
* Initialize the indexing submodule.
*
- * @param s scheduler to use
* @param c configuration to use
* @param d datastore to use
*/
int
-GNUNET_FS_indexing_init (struct GNUNET_SCHEDULER_Handle *s,
- const struct GNUNET_CONFIGURATION_Handle *c,
+GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_DATASTORE_Handle *d)
{
- sched = s;
cfg = c;
dsh = d;
ifm = GNUNET_CONTAINER_multihashmap_create (128);
- GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task,
NULL);
read_index_list ();