[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6212 - in GNUnet/src: applications applications/fs/ecrs ap
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6212 - in GNUnet/src: applications applications/fs/ecrs applications/fs/fsui applications/fs/tools include |
Date: |
Sat, 9 Feb 2008 19:37:13 -0700 (MST) |
Author: grothoff
Date: 2008-02-09 19:37:13 -0700 (Sat, 09 Feb 2008)
New Revision: 6212
Modified:
GNUnet/src/applications/Makefile.am
GNUnet/src/applications/fs/ecrs/downloadtest.c
GNUnet/src/applications/fs/ecrs/ecrstest.c
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/searchtest.c
GNUnet/src/applications/fs/ecrs/unindex.c
GNUnet/src/applications/fs/fsui/deserialize.c
GNUnet/src/applications/fs/fsui/fsui.h
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/applications/fs/fsui/searchtest.c
GNUnet/src/applications/fs/fsui/serialize.c
GNUnet/src/applications/fs/fsui/unindex.c
GNUnet/src/applications/fs/tools/gnunet-search.c
GNUnet/src/include/gnunet_ecrs_lib.h
GNUnet/src/include/gnunet_fsui_lib.h
GNUnet/src/include/gnunet_sqstore_service.h
Log:
removing timeout and result limit from ECRS/FSUI search API
Modified: GNUnet/src/applications/Makefile.am
===================================================================
--- GNUnet/src/applications/Makefile.am 2008-02-10 02:36:45 UTC (rev 6211)
+++ GNUnet/src/applications/Makefile.am 2008-02-10 02:37:13 UTC (rev 6212)
@@ -12,13 +12,11 @@
SUBDIRS = \
identity \
- testing \
bootstrap_http \
datastore \
rpc \
fragmentation \
getoption \
- fs \
state \
stats \
pingpong \
@@ -33,5 +31,7 @@
advertising \
dht \
tracekit \
- $(VPN_DIR)
+ $(VPN_DIR) \
+ fs \
+ testing
# chat
Modified: GNUnet/src/applications/fs/ecrs/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/downloadtest.c 2008-02-10 02:36:45 UTC
(rev 6211)
+++ GNUnet/src/applications/fs/ecrs/downloadtest.c 2008-02-10 02:37:13 UTC
(rev 6212)
@@ -88,7 +88,7 @@
GNUNET_disk_file_open (NULL, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
buf = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
- for (i = 0; i < (int) (size - 42 - sizeof (GNUNET_HashCode));
+ for (i = 0; i < (int) (size - 42 - 2 * sizeof (GNUNET_HashCode));
i += sizeof (GNUNET_HashCode))
GNUNET_hash (&buf[i], 42,
(GNUNET_HashCode *) & buf[i + sizeof (GNUNET_HashCode)]);
@@ -144,7 +144,7 @@
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
- for (i = 0; i < (int) (size - 42 - sizeof (GNUNET_HashCode));
+ for (i = 0; i < (int) (size - 42 - 2 * sizeof (GNUNET_HashCode));
i += sizeof (GNUNET_HashCode))
GNUNET_hash (&buf[i], 42,
(GNUNET_HashCode *) & buf[i +
Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-02-10 02:37:13 UTC (rev
6212)
@@ -69,7 +69,7 @@
GNUNET_disk_file_open (NULL, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
buf = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
- for (i = 0; i < (int) (size - 42 - sizeof (GNUNET_HashCode));
+ for (i = 0; i < (int) (size - 42 - 2 * sizeof (GNUNET_HashCode));
i += sizeof (GNUNET_HashCode))
GNUNET_hash (&buf[i], 42,
(GNUNET_HashCode *) & buf[i + sizeof (GNUNET_HashCode)]);
@@ -147,7 +147,6 @@
cfg,
*uri,
0,
- 15 * GNUNET_CRON_SECONDS,
&searchCB, &myURI, &testTerminate, NULL);
GNUNET_ECRS_uri_destroy (*uri);
*uri = myURI;
@@ -185,7 +184,7 @@
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
- for (i = 0; i < (int) (size - 42 - sizeof (GNUNET_HashCode));
+ for (i = 0; i < (int) (size - 42 - 2 * sizeof (GNUNET_HashCode));
i += sizeof (GNUNET_HashCode))
GNUNET_hash (&buf[i], 42,
(GNUNET_HashCode *) & buf[i + sizeof (GNUNET_HashCode)]);
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/ecrs/search.c 2008-02-10 02:37:13 UTC (rev
6212)
@@ -549,24 +549,17 @@
struct GNUNET_GC_Configuration *cfg,
const struct GNUNET_ECRS_URI *uri,
unsigned int anonymityLevel,
- GNUNET_CronTime timeout,
GNUNET_ECRS_SearchResultProcessor spcb,
void *spcbClosure, GNUNET_ECRS_TestTerminate tt,
void *ttClosure)
{
struct PendingSearch *pos;
struct SearchContext ctx;
- GNUNET_CronTime now;
- GNUNET_CronTime remTime;
- now = GNUNET_get_time ();
- ctx.start = now;
+ ctx.start = GNUNET_get_time ();
ctx.anonymityLevel = anonymityLevel;
- if (timeout != 0)
- timeout += now;
ctx.ectx = ectx;
ctx.cfg = cfg;
- ctx.timeout = timeout;
ctx.queries = NULL;
ctx.spcb = spcb;
ctx.spcbClosure = spcbClosure;
@@ -577,14 +570,8 @@
while (((NULL == tt) ||
(GNUNET_OK == tt (ttClosure))) &&
(GNUNET_NO == GNUNET_shutdown_test ()) &&
- ((timeout == 0) || (timeout > now)) && (ctx.aborted == GNUNET_NO))
- {
- remTime = timeout - now;
- if (remTime > 100 * GNUNET_CRON_MILLISECONDS)
- remTime = 100 * GNUNET_CRON_MILLISECONDS;
- GNUNET_thread_sleep (remTime);
- now = GNUNET_get_time ();
- }
+ (ctx.aborted == GNUNET_NO))
+ GNUNET_thread_sleep (100 * GNUNET_CRON_MILLISECONDS);
GNUNET_FS_destroy_search_context (ctx.sctx);
while (ctx.queries != NULL)
{
Modified: GNUnet/src/applications/fs/ecrs/searchtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/searchtest.c 2008-02-10 02:36:45 UTC
(rev 6211)
+++ GNUnet/src/applications/fs/ecrs/searchtest.c 2008-02-10 02:37:13 UTC
(rev 6212)
@@ -68,7 +68,6 @@
cfg,
uri,
0,
- 60 * 15 * GNUNET_CRON_SECONDS,
&searchCB, &resultCount, &testTerminate, NULL);
if (resultCount > 0)
return GNUNET_SYSERR;
Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/ecrs/unindex.c 2008-02-10 02:37:13 UTC (rev
6212)
@@ -164,12 +164,12 @@
* @return GNUNET_SYSERR if the unindexing failed (i.e. not indexed)
*/
int
-GNUNET_ECRS_file_uninde (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char *filename,
- GNUNET_ECRS_UploadProgressCallback upcb,
- void *upcbClosure, GNUNET_ECRS_TestTerminate tt,
- void *ttClosure)
+GNUNET_ECRS_file_unindex (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *filename,
+ GNUNET_ECRS_UploadProgressCallback upcb,
+ void *upcbClosure, GNUNET_ECRS_TestTerminate tt,
+ void *ttClosure)
{
unsigned long long filesize;
unsigned long long pos;
Modified: GNUnet/src/applications/fs/fsui/deserialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/deserialize.c 2008-02-10 02:36:45 UTC
(rev 6211)
+++ GNUnet/src/applications/fs/fsui/deserialize.c 2008-02-10 02:37:13 UTC
(rev 6212)
@@ -393,8 +393,6 @@
list = GNUNET_malloc (sizeof (GNUNET_FSUI_SearchList));
memset (list, 0, sizeof (GNUNET_FSUI_SearchList));
if ((GNUNET_OK != read_int (fd, (int *) &list->state)) ||
- (GNUNET_OK != read_int (fd, (int *) &list->maxResults)) ||
- (GNUNET_OK != read_long (fd, (long long *) &list->timeout)) ||
(GNUNET_OK != read_long (fd, (long long *) &list->start_time)) ||
(GNUNET_OK != read_long (fd, (long long *) &stime)) ||
(GNUNET_OK != read_int (fd, (int *) &list->anonymityLevel)) ||
Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/fsui/fsui.h 2008-02-10 02:37:13 UTC (rev
6212)
@@ -62,11 +62,6 @@
{
/**
- * Desired timeout (relative) for this search
- */
- GNUNET_CronTime timeout;
-
- /**
* start time of the search
*/
GNUNET_CronTime start_time;
@@ -111,11 +106,6 @@
unsigned int anonymityLevel;
/**
- * Maximum number of results requested.
- */
- unsigned int maxResults;
-
- /**
* Of how many individual queries does the
* boolean query consist (1 for non-boolean queries).
*/
Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/fsui/search.c 2008-02-10 02:37:13 UTC (rev
6212)
@@ -202,8 +202,7 @@
testTerminate (void *cls)
{
GNUNET_FSUI_SearchList *pos = cls;
- if ((pos->state == GNUNET_FSUI_ACTIVE) &&
- (pos->maxResults > pos->sizeResultsReceived))
+ if (pos->state == GNUNET_FSUI_ACTIVE)
return GNUNET_OK;
return GNUNET_SYSERR;
}
@@ -227,7 +226,7 @@
GNUNET_GE_IMMEDIATE, mem);
ret =
GNUNET_ECRS_search (ee, pos->ctx->cfg, pos->uri, pos->anonymityLevel,
- pos->timeout, &spcb, pos, &testTerminate, pos);
+ &spcb, pos, &testTerminate, pos);
if (ret != GNUNET_OK)
{
const char *error;
@@ -292,8 +291,6 @@
struct GNUNET_FSUI_SearchList *
GNUNET_FSUI_search_start (struct GNUNET_FSUI_Context *ctx,
unsigned int anonymityLevel,
- unsigned int maxResults,
- GNUNET_CronTime timeout,
const struct GNUNET_ECRS_URI *uri)
{
GNUNET_FSUI_SearchList *pos;
@@ -302,7 +299,6 @@
ectx = ctx->ectx;
GNUNET_mutex_lock (ctx->lock);
pos = GNUNET_malloc (sizeof (GNUNET_FSUI_SearchList));
- pos->maxResults = maxResults;
pos->state = GNUNET_FSUI_ACTIVE;
pos->uri = GNUNET_ECRS_uri_duplicate (uri);
pos->numberOfURIKeys = GNUNET_ECRS_uri_get_keyword_count_from_ksk (uri);
@@ -313,7 +309,6 @@
pos->anonymityLevel = anonymityLevel;
pos->ctx = ctx;
pos->start_time = GNUNET_get_time ();
- pos->timeout = timeout;
pos->handle =
GNUNET_thread_create (&GNUNET_FSUI_searchThreadSignal, pos, 32 * 1024);
if (pos->handle == NULL)
@@ -366,6 +361,8 @@
int i;
GNUNET_mutex_lock (ctx->lock);
+ if (sl->state == GNUNET_FSUI_ACTIVE)
+ GNUNET_FSUI_search_abort(ctx, sl);
prev = NULL;
pos = ctx->activeSearches;
while ((pos != sl) && (pos != NULL))
@@ -387,8 +384,7 @@
GNUNET_array_grow (sl->my_downloads, sl->my_downloads_size, 0);
GNUNET_mutex_unlock (ctx->lock);
pos->next = NULL;
- if ((pos->state == GNUNET_FSUI_ACTIVE) ||
- (pos->state == GNUNET_FSUI_COMPLETED) ||
+ if ((pos->state == GNUNET_FSUI_COMPLETED) ||
(pos->state == GNUNET_FSUI_ABORTED)
|| (pos->state == GNUNET_FSUI_ERROR))
{
Modified: GNUnet/src/applications/fs/fsui/searchtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/searchtest.c 2008-02-10 02:36:45 UTC
(rev 6211)
+++ GNUnet/src/applications/fs/fsui/searchtest.c 2008-02-10 02:37:13 UTC
(rev 6212)
@@ -155,7 +155,7 @@
keywords[1]);
luri = GNUNET_ECRS_keyword_string_to_uri (NULL, keyword);
search =
- GNUNET_FSUI_search_start (ctx, 0, 100, 240 * GNUNET_CRON_SECONDS, luri);
+ GNUNET_FSUI_search_start (ctx, 0, luri);
GNUNET_ECRS_uri_destroy (luri);
uri = NULL;
CHECK (NULL != search);
Modified: GNUnet/src/applications/fs/fsui/serialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serialize.c 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/fsui/serialize.c 2008-02-10 02:37:13 UTC (rev
6212)
@@ -204,8 +204,6 @@
GNUNET_ECRS_uri_test_sks (spos->uri));
WRITEINT (fd, 1);
WRITEINT (fd, spos->state);
- WRITEINT (fd, spos->maxResults);
- WRITELONG (fd, spos->timeout);
WRITELONG (fd, spos->start_time);
WRITELONG (fd, GNUNET_get_time ());
WRITEINT (fd, spos->anonymityLevel);
Modified: GNUnet/src/applications/fs/fsui/unindex.c
===================================================================
--- GNUnet/src/applications/fs/fsui/unindex.c 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/applications/fs/fsui/unindex.c 2008-02-10 02:37:13 UTC (rev
6212)
@@ -89,7 +89,7 @@
GNUNET_GE_FATAL | GNUNET_GE_BULK |
GNUNET_GE_IMMEDIATE, mem);
ret =
- GNUNET_ECRS_file_uninde (ee, utc->ctx->cfg, utc->filename,
+ GNUNET_ECRS_file_unindex (ee, utc->ctx->cfg, utc->filename,
&progressCallback, utc, &tt, utc);
if (ret == GNUNET_OK)
{
Modified: GNUnet/src/applications/fs/tools/gnunet-search.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-search.c 2008-02-10 02:36:45 UTC
(rev 6211)
+++ GNUnet/src/applications/fs/tools/gnunet-search.c 2008-02-10 02:37:13 UTC
(rev 6212)
@@ -36,10 +36,6 @@
static unsigned int anonymity = 1;
-static unsigned int delay = 300;
-
-static unsigned int max_results;
-
static char *cfgFilename = GNUNET_DEFAULT_CLIENT_CONFIG_FILE;
static char *output_filename;
@@ -139,15 +135,9 @@
GNUNET_COMMAND_LINE_OPTION_HELP (gettext_noop ("Search GNUnet for files.")),
/* -h */
GNUNET_COMMAND_LINE_OPTION_HOSTNAME, /* -H */
GNUNET_COMMAND_LINE_OPTION_LOGGING, /* -L */
- {'m', "max", "LIMIT",
- gettext_noop ("exit after receiving LIMIT results"),
- 1, &GNUNET_getopt_configure_set_uint, &max_results},
{'o', "output", "FILENAME",
gettext_noop ("write encountered (decrypted) search results to FILENAME"),
1, &GNUNET_getopt_configure_set_string, &output_filename},
- {'t', "timeout", "DELAY",
- gettext_noop ("wait DELAY seconds for search results before aborting"),
- 1, &GNUNET_getopt_configure_set_uint, &delay},
GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
@@ -187,8 +177,6 @@
errorCode = -1;
goto quit;
}
- if (max_results == 0)
- max_results = (unsigned int) -1; /* infty */
ctx =
GNUNET_FSUI_start (ectx, cfg, "gnunet-search", 4, GNUNET_NO,
&eventCallback, NULL);
@@ -200,8 +188,7 @@
}
errorCode = 1;
s = GNUNET_FSUI_search_start (ctx,
- anonymity, max_results,
- delay * GNUNET_CRON_SECONDS, uri);
+ anonymity, uri);
GNUNET_ECRS_uri_destroy (uri);
if (s == NULL)
{
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2008-02-10 02:37:13 UTC (rev
6212)
@@ -586,7 +586,7 @@
*
* @return GNUNET_SYSERR if the unindexing failed (i.e. not indexed)
*/
-int GNUNET_ECRS_file_uninde (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *filename,
GNUNET_ECRS_UploadProgressCallback upcb, void *upcbClosure,
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* unindex.c */
+int GNUNET_ECRS_file_unindex (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const char *filename,
GNUNET_ECRS_UploadProgressCallback upcb, void *upcbClosure,
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* unindex.c */
/**
@@ -691,11 +691,10 @@
/**
* Search for content.
*
- * @param timeout how long to wait (relative)
* @param uri specifies the search parameters
* @param uri set to the URI of the uploaded file
*/
-int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, unsigned int
anonymityLevel, GNUNET_CronTime timeout, GNUNET_ECRS_SearchResultProcessor
spcb, void *spcbClosure, GNUNET_ECRS_TestTerminate tt, void *ttClosure);
/* search.c */
+int GNUNET_ECRS_search (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const struct GNUNET_ECRS_URI *uri, unsigned int
anonymityLevel, GNUNET_ECRS_SearchResultProcessor spcb, void *spcbClosure,
GNUNET_ECRS_TestTerminate tt, void *ttClosure); /* search.c */
/**
* Notification of ECRS to a client about the progress of an insertion
Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/include/gnunet_fsui_lib.h 2008-02-10 02:37:13 UTC (rev
6212)
@@ -862,7 +862,7 @@
*
* @return NULL on error
*/
-struct GNUNET_FSUI_SearchList *GNUNET_FSUI_search_start (struct
GNUNET_FSUI_Context *ctx, unsigned int anonymityLevel, unsigned int maxResults,
GNUNET_CronTime timeout, const struct GNUNET_ECRS_URI *uri); /* search.c */
+struct GNUNET_FSUI_SearchList *GNUNET_FSUI_search_start (struct
GNUNET_FSUI_Context *ctx, unsigned int anonymityLevel, const struct
GNUNET_ECRS_URI *uri); /* search.c */
/**
* Abort a search.
Modified: GNUnet/src/include/gnunet_sqstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_sqstore_service.h 2008-02-10 02:36:45 UTC (rev
6211)
+++ GNUnet/src/include/gnunet_sqstore_service.h 2008-02-10 02:37:13 UTC (rev
6212)
@@ -74,9 +74,12 @@
* @param key maybe NULL (to match all entries)
* @param type entries of which type are relevant?
* Use 0 for any type.
- * @param iter maybe NULL (to just count)
- * @return the number of results, GNUNET_SYSERR if the
- * iter is non-NULL and aborted the iteration
+ * @param iter maybe NULL (to just count); iter
+ * should return GNUNET_SYSERR to abort the
+ * iteration, GNUNET_NO to delete the entry and
+ * continue and GNUNET_OK to continue iterating
+ * @return the number of results processed,
+ * GNUNET_SYSERR on error
*/
int (*get) (const GNUNET_HashCode * key,
unsigned int type, GNUNET_DatastoreValueIterator iter,
@@ -126,8 +129,7 @@
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter never NULL
- * @return the number of results, GNUNET_SYSERR if the
- * iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
*/
int (*iterateNonAnonymous) (unsigned int type,
GNUNET_DatastoreValueIterator iter,
@@ -140,8 +142,7 @@
* @param type entries of which type should be considered?
* Use 0 for any type.
* @param iter never NULL
- * @return the number of results, GNUNET_SYSERR if the
- * iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
*/
int (*iterateExpirationTime) (unsigned int type,
GNUNET_DatastoreValueIterator iter,
@@ -153,8 +154,7 @@
* order.
*
* @param iter never NULL
- * @return the number of results, GNUNET_SYSERR if the
- * iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
*/
int (*iterateMigrationOrder) (GNUNET_DatastoreValueIterator iter,
void *closure);
@@ -166,8 +166,7 @@
* is on doing it fast).
*
* @param iter never NULL
- * @return the number of results, GNUNET_SYSERR if the
- * iter is non-NULL and aborted the iteration
+ * @return the number of results, GNUNET_SYSERR on error
*/
int (*iterateAllNow) (GNUNET_DatastoreValueIterator iter, void *closure);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6212 - in GNUnet/src: applications applications/fs/ecrs applications/fs/fsui applications/fs/tools include,
gnunet <=