sessions even if no connections exist for a while! (likely related...)
- transport reports bw quota violations on big-endian systems (core or
transport issue?)
+* DATASTORE:
+ - utilization can (easily, restart?) go out of control (very large), causing
+ content expiration job to go crazy and delete everything!
* FS:
+ ! fs_search test fails (hangs) since blocktype was changed from "ANY" to "KBLOCK"!
+ (insert blocktype wrong? or what!?)
+ ! fs_namespace test fails (hangs), but local fs service has found results; somehow
+ they are not passed to the client and/or the shutdown sequence is not working
- gnunet-publish cannot be aborted using CTRL-C
- on some systems, keyword search does not find locally published content
- (need testcase of command-line tools!)
+ (need testcase of command-line tools! - also good to cover getopt API!)
- 2-peer download is still too slow (why?)
- advanced FS API parts
+ search: SBlocks, NBlocks, probes, notify FS-service of known results
- + location URIs (publish, search, download)
+ indexing: index-failure-cleanup
+ gnunet-publish (URI args)
+ gnunet-download (directory)
+ gnunet-download (many options)
+ gnunet-directory (man page, options)
+ gnunet-pseudonym (all of it)
- + gnunet-service-fs (remove failing on-demand blocks, hot-path routing, load-based routing, nitpicks)
+ + gnunet-service-fs (remove failing on-demand blocks, hot-path routing,
+ load-based routing, nitpicks)
- implement adv. FS testcases
- + getopt API
- + insert: sblocks, loc uris
- + download: loc uris
- + search: sblocks, nblocks, loc uris
- + namespaces
- [./fs/gnunet-service-fs.c:208]: (style) struct or union member 'LocalGetContext::results_bf_size' is never used
- [./fs/gnunet-service-fs.c:501]: (style) struct or union member 'PendingRequest::used_pids_size' is never used
- [./fs/gnunet-service-fs.c:654]: (style) struct or union member 'ConnectedPeer::last_client_replies' is never used
- [./fs/gnunet-service-fs.c:688]: (style) struct or union member 'ConnectedPeer::pending_requests' is never used
- [./fs/gnunet-service-fs.c:694]: (style) struct or union member 'ConnectedPeer::last_p2p_replies_woff' is never used
- [./fs/gnunet-service-fs.c:700]: (style) struct or union member 'ConnectedPeer::last_client_replies_woff' is never used
-
* WWW:
- Get IPv6 hooked up
- change DNS
0.9.0pre1:
* Module features to implement:
- tbench (RC-pre1)
- + good to have for DV evaluation!
+ + good to have for DV evaluation! [MW]
- DV (RC-pre1)
+ write DV API
+ implement DV service [Nate & CG]
+ how to integrate scheduler with GTK event loop!
* STATISTICS:
- does not seem to work with timeouts (especially if service is not running)
-* UTIL:
+* PEERINFO:
- trust: need *fast* way to check/update trust in peers
- (async peerinfo would not be right)
+ (async peerinfo would not be right; certainly not with the
+ current API)
+* UTIL:
- scheduler should change OS process priority based on task priority;
should make better use of task priorities in general
- only connect() sockets that are ready (select()) [Nils]
debug output, detect random vs. deterministic crashes)
- shutdown sequence?
* FS:
+ - location URIs (publish, search, download)
- collection API & tests
- implement FS performance tests
+ insert
/**
* Type of the content that we're looking for.
- * 0 for any.
*/
uint32_t type GNUNET_PACKED;
/*
This file is part of GNUnet.
- (C) 2009 Christian Grothoff (and other contributing authors)
+ (C) 2009, 2010 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
#include "fs.h"
#include "fs_tree.h"
-#define DEBUG_PUBLISH GNUNET_NO
+#define DEBUG_PUBLISH GNUNET_YES
/**
* Main function that performs the upload.
struct SBlock *sb;
struct SBlock *sb_enc;
char *dest;
- GNUNET_HashCode key; /* hash of thisId = key */
+ GNUNET_HashCode key; /* hash of thisId = key */
GNUNET_HashCode id; /* hash of hc = identifier */
+ GNUNET_HashCode query; /* id ^ nsid = DB query */
uris = GNUNET_FS_uri_to_string (uri);
slen = strlen (uris) + 1;
_("Failed to connect to datastore."));
return;
}
-
+ GNUNET_CRYPTO_hash_xor (&sks_uri->data.sks.namespace,
+ &id,
+ &query);
GNUNET_DATASTORE_put (psc->dsh,
0,
- &sb->identifier,
+ &sb_enc->identifier,
size,
sb_enc,
GNUNET_DATASTORE_BLOCKTYPE_SBLOCK,
GNUNET_CONSTANTS_SERVICE_TIMEOUT,
&sb_put_cont,
psc);
+
GNUNET_free (sb);
GNUNET_free (sb_enc);
}
-
-#if 0
-
-/**
- * Add an entry into a namespace.
- *
- * @param dstU to which URI should the namespace entry refer?
- * @param md what meta-data should be associated with the
- * entry?
- * @param thisId name of this entry in the namespace (keyword/identifier)
- * @param nextId name of the update for this entry (to be published in
- * the future; maybe NULL)
- * @param pid unique identifier of the namespace/pseudonym
- * @return URI on success, NULL on error
- */
-struct GNUNET_ECRS_URI *
-GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * pid,
- uint32_t anonymityLevel,
- uint32_t priority,
- GNUNET_CronTime expiration,
- const char *thisId,
- const char *nextId,
- const struct GNUNET_ECRS_URI *dstU,
- const struct GNUNET_MetaData *md)
-{
- struct GNUNET_ECRS_URI *uri;
- struct GNUNET_ClientServerConnection *sock;
- GNUNET_DatastoreValue *value;
- unsigned int size;
- unsigned int mdsize;
- struct GNUNET_RSA_PrivateKey *hk;
- GNUNET_EC_SBlock *sb;
- char *dstURI;
- char *destPos;
- GNUNET_HashCode hc; /* hash of thisId = key */
- GNUNET_HashCode hc2; /* hash of hc = identifier */
- int ret;
- unsigned int nidlen;
-
- hk = read_namespace_key (cfg, pid);
- if (hk == NULL)
- return NULL;
-
- /* THEN: construct GNUNET_EC_SBlock */
- dstURI = GNUNET_ECRS_uri_to_string (dstU);
- mdsize = GNUNET_meta_data_get_serialized_size (md, GNUNET_SERIALIZE_PART);
- if (nextId == NULL)
- nextId = "";
- nidlen = strlen (nextId) + 1;
- size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1 + nidlen;
- if (size > MAX_SBLOCK_SIZE)
- {
- size = MAX_SBLOCK_SIZE;
- mdsize =
- size - (sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1 + nidlen);
- }
- value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- sb = (GNUNET_EC_SBlock *) & value[1];
- sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
- destPos = (char *) &sb[1];
- memcpy (destPos, nextId, nidlen);
- destPos += nidlen;
- memcpy (destPos, dstURI, strlen (dstURI) + 1);
- destPos += strlen (dstURI) + 1;
- mdsize = GNUNET_meta_data_serialize (ectx,
- md,
- destPos,
- mdsize, GNUNET_SERIALIZE_PART);
- if (mdsize == -1)
- {
- GNUNET_GE_BREAK (ectx, 0);
- GNUNET_free (dstURI);
- GNUNET_RSA_free_key (hk);
- GNUNET_free (value);
- return NULL;
- }
- size = sizeof (GNUNET_EC_SBlock) + mdsize + strlen (dstURI) + 1 + nidlen;
- value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
- value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
- value->priority = htonl (priority);
- value->anonymity_level = htonl (anonymityLevel);
- value->expiration_time = GNUNET_htonll (expiration);
- GNUNET_hash (thisId, strlen (thisId), &hc);
- GNUNET_hash (&hc, sizeof (GNUNET_HashCode), &hc2);
- uri = GNUNET_malloc (sizeof (URI));
- uri->type = sks;
- GNUNET_RSA_get_public_key (hk, &sb->subspace);
- GNUNET_hash (&sb->subspace,
- sizeof (GNUNET_RSA_PublicKey), &uri->data.sks.namespace);
- GNUNET_GE_BREAK (ectx, 0 == memcmp (&uri->data.sks.namespace,
- pid, sizeof (GNUNET_HashCode)));
- uri->data.sks.identifier = GNUNET_strdup (thisId);
- GNUNET_hash_xor (&hc2, &uri->data.sks.namespace, &sb->identifier);
- GNUNET_ECRS_encryptInPlace (&hc, &sb[1], size - sizeof (GNUNET_EC_SBlock));
- GNUNET_GE_ASSERT (ectx,
- GNUNET_OK == GNUNET_RSA_sign (hk,
- size
- -
- sizeof
- (GNUNET_RSA_Signature) -
- sizeof
- (GNUNET_RSA_PublicKey) -
- sizeof (unsigned int),
- &sb->identifier,
- &sb->signature));
- GNUNET_RSA_free_key (hk);
- sock = GNUNET_client_connection_create (ectx, cfg);
- ret = GNUNET_FS_insert (sock, value);
- if (ret != GNUNET_OK)
- {
- GNUNET_free (uri);
- uri = NULL;
- }
- GNUNET_client_connection_destroy (sock);
- GNUNET_free (value);
- GNUNET_free (dstURI);
-
- return uri;
-}
-
-#endif
-
-
/* end of fs_publish.c */
#include "gnunet_protocols.h"
#include "fs.h"
-#define DEBUG_SEARCH GNUNET_NO
+#define DEBUG_SEARCH GNUNET_YES
/**
- * Check if the given result is identical
- * to the given URI and if so return it.
+ * Check if the given result is identical to the given URI and if so
+ * return it.
*
* @param cls a "struct GetResultContext"
* @param key not used
/**
- * We have received a KSK result. Check
- * how it fits in with the overall query
- * and notify the client accordingly.
+ * We have received a KSK result. Check how it fits in with the
+ * overall query and notify the client accordingly.
*
* @param sc context for the overall query
* @param ent entry for the specific keyword
int is_new;
/* check if new */
- if (! GNUNET_FS_uri_test_chk (uri))
- {
- GNUNET_break_op (0);
- return;
- }
- GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key,
- &uri->data.chk.chk.query,
- &key);
+ GNUNET_FS_uri_to_key (uri, &key);
if (GNUNET_SYSERR ==
GNUNET_CONTAINER_multihashmap_get_multiple (ent->results,
&key,
/**
- * We have received an SKS result. Start
- * searching for updates and notify the
- * client if it is a new result.
+ * We have received an SKS result. Start searching for updates and
+ * notify the client if it is a new result.
*
* @param sc context for the overall query
* @param id_update identifier for updates, NULL for none
struct SearchResult *sr;
/* check if new */
- if (! GNUNET_FS_uri_test_ksk (uri))
- {
- GNUNET_break_op (0);
- return;
- }
+ GNUNET_FS_uri_to_key (uri, &key);
GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key,
&uri->data.chk.chk.query,
&key);
struct SearchMessage *sm;
unsigned int i;
const char *identifier;
+ GNUNET_HashCode key;
GNUNET_HashCode idh;
if (NULL == buf)
{
sm[i].header.size = htons (sizeof (struct SearchMessage));
sm[i].header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
- sm[i].anonymity_level = htonl (sc->anonymity);
+ sm[i].type = htonl (GNUNET_DATASTORE_BLOCKTYPE_KBLOCK);
+ sm[i].anonymity_level = htonl (sc->anonymity);
sm[i].query = sc->requests[i].query;
}
}
else
{
+ GNUNET_assert (GNUNET_FS_uri_test_sks (sc->uri));
msize = sizeof (struct SearchMessage);
GNUNET_assert (size >= msize);
sm = buf;
memset (sm, 0, msize);
sm->header.size = htons (sizeof (struct SearchMessage));
sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
+ sm->type = htonl (GNUNET_DATASTORE_BLOCKTYPE_SBLOCK);
sm->anonymity_level = htonl (sc->anonymity);
sm->target = sc->uri->data.sks.namespace;
identifier = sc->uri->data.sks.identifier;
GNUNET_CRYPTO_hash (identifier,
strlen (identifier),
+ &key);
+ GNUNET_CRYPTO_hash (&key,
+ sizeof (GNUNET_HashCode),
&idh);
GNUNET_CRYPTO_hash_xor (&idh,
&sm->target,
&sm->query);
- }
+ }
GNUNET_CLIENT_receive (sc->client,
&receive_results,
sc,
sc->client_info = cctx;
if (GNUNET_FS_uri_test_ksk (uri))
{
+ GNUNET_assert (0 != sc->uri->data.ksk.keywordCount);
sc->requests = GNUNET_malloc (sizeof (struct SearchRequestEntry) *
sc->uri->data.ksk.keywordCount);
for (i=0;i<sc->uri->data.ksk.keywordCount;i++)
return GNUNET_SYSERR;
}
if (dsize !=
- ntohs (sb->purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
+ ntohl (sb->purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
do_remove = GNUNET_YES;
break;
case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+ if (pr->namespace == NULL)
+ {
+ GNUNET_break (0);
+ return GNUNET_YES;
+ }
if (0 != memcmp (pr->namespace,
&prq->namespace,
sizeof (GNUNET_HashCode)))
#if DEBUG_FS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received request for `%s' of type %u from peer `%4s'\n",
+ "Received request for `%s' of type %u from peer `%4s' with flags %u\n",
GNUNET_h2s (&gm->query),
(unsigned int) type,
- GNUNET_i2s (other));
+ GNUNET_i2s (other),
+ (unsigned int) bm);
#endif
have_ns = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE));
pr = GNUNET_malloc (sizeof (struct PendingRequest) +
client_list = cl;
}
type = ntohl (sm->type);
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received request for `%s' of type %u from local client\n",
+ GNUNET_h2s (&sm->query),
+ (unsigned int) type);
+#endif
switch (type)
{
- case GNUNET_DATASTORE_BLOCKTYPE_ANY:
case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
GNUNET_SYSERR);
return;
}
-#if DEBUG_FS
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received request for `%s' of type %u from local client\n",
- GNUNET_h2s (&sm->query),
- (unsigned int) type);
-#endif
/* detect duplicate KBLOCK requests */
if (type == GNUNET_DATASTORE_BLOCKTYPE_KBLOCK)
* @file fs/test_fs_namespace.c
* @brief Test for fs_namespace.c
* @author Christian Grothoff
+ *
+ * TODO:
+ * - add timeout task
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_fs_service.h"
+#define VERBOSE GNUNET_YES
+
#define START_ARM GNUNET_YES
static struct GNUNET_SCHEDULER_Handle *sched;
static struct PeerContext p1;
+static GNUNET_HashCode nsid;
+
+static struct GNUNET_FS_Uri *sks_expect_uri;
+
+static struct GNUNET_FS_Uri *ksk_expect_uri;
+
static struct GNUNET_FS_Handle *fs;
+static struct GNUNET_FS_SearchContext *sks_search;
+
+static struct GNUNET_FS_SearchContext *ksk_search;
+
+static int update_started;
+
+static int err;
struct PeerContext
{
}
-#if 0
static void
-spcb (void *cls,
- const char *name,
- const GNUNET_HashCode * key)
+abort_ksk_search_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ if (ksk_search != NULL)
+ {
+ GNUNET_FS_search_stop (ksk_search);
+ ksk_search = NULL;
+ if (sks_search == NULL)
+ GNUNET_FS_stop (fs);
+ }
}
-#endif
+static void
+abort_sks_search_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct GNUNET_FS_Namespace *ns;
+
+ if (sks_search != NULL)
+ {
+ GNUNET_FS_search_stop (sks_search);
+ sks_search = NULL;
+ ns = GNUNET_FS_namespace_create (fs,
+ "testNamespace");
+ GNUNET_assert (GNUNET_OK == GNUNET_FS_namespace_delete (ns, GNUNET_YES));
+ if (ksk_search == NULL)
+ GNUNET_FS_stop (fs);
+ }
+}
+
static void *
progress_cb (void *cls,
const struct GNUNET_FS_ProgressInfo *event)
{
+ switch (event->status)
+ {
+ case GNUNET_FS_STATUS_SEARCH_RESULT:
+ if (sks_search == event->value.search.sc)
+ {
+ fprintf (stderr,
+ "Search result for sks received\n");
+ if (! GNUNET_FS_uri_test_equal (sks_expect_uri,
+ event->value.search.specifics.result.uri))
+ {
+ fprintf (stderr,
+ "Wrong result for sks search!\n");
+ err = 1;
+ }
+ /* give system 1ms to initiate update search! */
+ GNUNET_SCHEDULER_add_delayed (sched,
+ GNUNET_TIME_UNIT_MILLISECONDS,
+ &abort_sks_search_task,
+ NULL);
+ }
+ else if (ksk_search == event->value.search.sc)
+ {
+ fprintf (stderr,
+ "Search result for ksk received\n");
+ if (! GNUNET_FS_uri_test_equal (ksk_expect_uri,
+ event->value.search.specifics.result.uri))
+ {
+ fprintf (stderr,
+ "Wrong result for ksk search!\n");
+ err = 1;
+ }
+ GNUNET_SCHEDULER_add_continuation (sched,
+ &abort_ksk_search_task,
+ NULL,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+ }
+ else
+ {
+ fprintf (stderr,
+ "Search result received!?\n");
+ GNUNET_break (0);
+ }
+ break;
+ case GNUNET_FS_STATUS_SEARCH_ERROR:
+ fprintf (stderr,
+ "Error searching file: %s\n",
+ event->value.search.specifics.error.message);
+ if (sks_search == event->value.search.sc)
+ GNUNET_SCHEDULER_add_continuation (sched,
+ &abort_sks_search_task,
+ NULL,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+ else if (ksk_search == event->value.search.sc)
+ GNUNET_SCHEDULER_add_continuation (sched,
+ &abort_ksk_search_task,
+ NULL,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+ else
+ GNUNET_break (0);
+ break;
+ case GNUNET_FS_STATUS_SEARCH_START:
+ fprintf (stderr,
+ "Search start event for `%s' received\n",
+ (const char*) event->value.search.cctx);
+ GNUNET_assert ( (NULL == event->value.search.cctx) ||
+ (0 == strcmp ("sks_search", event->value.search.cctx)) ||
+ (0 == strcmp ("ksk_search", event->value.search.cctx)));
+ if (NULL == event->value.search.cctx)
+ {
+ GNUNET_assert (sks_search == event->value.search.pctx);
+ update_started = GNUNET_YES;
+ }
+ GNUNET_assert (1 == event->value.search.anonymity);
+ break;
+ case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED:
+ break;
+ case GNUNET_FS_STATUS_SEARCH_STOPPED:
+ fprintf (stderr,
+ "Search stop event received\n");
+ GNUNET_assert ( (ksk_search == event->value.search.sc) ||
+ (sks_search == event->value.search.sc));
+ break;
+ default:
+ fprintf (stderr,
+ "Unexpected event: %d\n",
+ event->status);
+ break;
+ }
return NULL;
}
const struct GNUNET_FS_Uri *ksk_uri,
const char *emsg)
{
- struct GNUNET_FS_SearchContext *search;
-
- GNUNET_assert (NULL == emsg);
+ char *msg;
+ struct GNUNET_FS_Uri *sks_uri;
+ char sbuf[1024];
+ struct GNUNET_CRYPTO_HashAsciiEncoded enc;
+
+ if (NULL != emsg)
+ {
+ fprintf (stderr, "Error publishing: %s\n", emsg);
+ err = 1;
+ GNUNET_FS_stop (fs);
+ return;
+ }
+ GNUNET_CRYPTO_hash_to_enc (&nsid,
+ &enc);
+ GNUNET_snprintf (sbuf,
+ sizeof (sbuf),
+ "gnunet://fs/sks/%s/this",
+ &enc);
+ sks_uri = GNUNET_FS_uri_parse (sbuf, &msg);
+ if (msg != NULL)
+ {
+ fprintf (stderr, "failed to parse URI `%s': %s\n",
+ sbuf,
+ msg);
+ err = 1;
+ GNUNET_FS_stop (fs);
+ return;
+ }
fprintf (stderr, "Starting keyword search...\n");
- search = GNUNET_FS_search_start (fs, ksk_uri, 1, NULL);
+ ksk_search = GNUNET_FS_search_start (fs, ksk_uri, 1, "ksk_search");
+ fprintf (stderr, "Starting namespace search...\n") ;
+ sks_search = GNUNET_FS_search_start (fs, sks_uri, 1, "sks_search");
+ GNUNET_FS_uri_destroy (sks_uri);
}
ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/ns-search", &msg);
GNUNET_assert (NULL == msg);
fprintf (stderr, "Advertising update 'this' namespace entry under keyword...\n");
+ ksk_expect_uri = GNUNET_FS_uri_dup (uri);
GNUNET_FS_publish_ksk (fs,
ksk_uri,
meta,
GNUNET_FS_PUBLISH_OPTION_NONE,
&publish_cont,
NULL);
+ GNUNET_FS_uri_destroy (ksk_uri);
GNUNET_CONTAINER_meta_data_destroy (meta);
}
struct GNUNET_FS_Namespace *ns;
struct GNUNET_TIME_Absolute expiration;
+ if (NULL != emsg)
+ {
+ fprintf (stderr, "Error publishing: %s\n", emsg);
+ err = 1;
+ GNUNET_FS_stop (fs);
+ return;
+ }
expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
ns = GNUNET_FS_namespace_create (fs,
"testNamespace");
meta = GNUNET_CONTAINER_meta_data_create ();
GNUNET_assert (NULL == emsg);
fprintf (stderr, "Advertising update 'this->next' namespace update...\n");
+ sks_expect_uri = GNUNET_FS_uri_dup (uri);
GNUNET_FS_publish_sks (fs,
ns,
"this",
"next",
meta,
- uri, /* FIXME: this is non-sense (use CHK URI!) */
+ uri, /* FIXME: this is non-sense (use CHK URI!?) */
expiration,
1, 1,
GNUNET_FS_PUBLISH_OPTION_NONE,
}
+static void
+ns_iterator (void *cls,
+ const char *name,
+ const GNUNET_HashCode *id)
+{
+ int *ok = cls;
+
+ if (0 != strcmp (name,
+ "testNamespace"))
+ return;
+ *ok = GNUNET_YES;
+ nsid = *id;
+}
+
+
static void
testNamespace ()
{
struct GNUNET_FS_Namespace *ns;
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_CONTAINER_MetaData *meta;
+ int ok;
- expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
- meta = GNUNET_CONTAINER_meta_data_create ();
ns = GNUNET_FS_namespace_create (fs,
"testNamespace");
+ ok = GNUNET_NO;
+ GNUNET_FS_namespace_list (fs, &ns_iterator, &ok);
+ if (GNUNET_NO == ok)
+ {
+ fprintf (stderr, "namespace_list failed to find namespace!\n");
+ GNUNET_FS_namespace_delete (ns, GNUNET_YES);
+ GNUNET_FS_stop (fs);
+ err = 1;
+ return;
+ }
fprintf (stderr, "Advertising namespace root...\n");
+ expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
+ meta = GNUNET_CONTAINER_meta_data_create ();
GNUNET_FS_namespace_advertise (fs,
ns,
meta,
GNUNET_CONTAINER_meta_data_destroy (meta);
}
-#if 0
- fprintf (stderr, "Completed namespace search...\n");
- GNUNET_assert (GNUNET_OK == GNUNET_FS_namespace_delete (NULL, cfg, &pid));
- GNUNET_assert (GNUNET_SYSERR == GNUNET_FS_namespace_delete (NULL, cfg, &pid));
- GNUNET_FS_uri_destroy (rootURI);
- GNUNET_FS_uri_destroy (advURI);
- GNUNET_assert (match == 1);
- return 0;
-}
-#endif
-
static void
run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
sched = s;
- setup_peer (&p1, "test_fs_download_data.conf");
+ setup_peer (&p1, "test_fs_namespace_data.conf");
fs = GNUNET_FS_start (sched,
cfg,
"test-fs-namespace",
argvx, "test-fs-namespace",
"nohelp", options, &run, NULL);
stop_arm (&p1);
+ if (GNUNET_YES != update_started)
+ {
+ fprintf (stderr,
+ "Update search never started!\n");
+ err = 1;
+ }
GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-namespace/");
- return 0;
+ return err;
}
-
/* end of test_fs_namespace.c */
DEFAULTSERVICES = resolver datastore transport core fs
[datastore]
-#DEBUG = YES
+DEBUG = YES
[statistics]
PORT = 42467
[fs]
PORT = 42471
HOSTNAME = localhost
-#DEBUG = YES
+IDENTITY_DIR = $SERVICEHOME/pseudos/
+DEBUG = YES
[testing]
WEAKRANDOM = YES