[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1669 - GNUnet/src/applications/fs/fsui
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1669 - GNUnet/src/applications/fs/fsui |
Date: |
Sun, 14 Aug 2005 16:40:08 -0700 (PDT) |
Author: grothoff
Date: 2005-08-14 16:40:07 -0700 (Sun, 14 Aug 2005)
New Revision: 1669
Modified:
GNUnet/src/applications/fs/fsui/check.conf
GNUnet/src/applications/fs/fsui/downloadtest.c
GNUnet/src/applications/fs/fsui/search.c
GNUnet/src/applications/fs/fsui/unindex.c
GNUnet/src/applications/fs/fsui/upload.c
Log:
update
Modified: GNUnet/src/applications/fs/fsui/check.conf
===================================================================
--- GNUnet/src/applications/fs/fsui/check.conf 2005-08-14 20:58:51 UTC (rev
1668)
+++ GNUnet/src/applications/fs/fsui/check.conf 2005-08-14 23:40:07 UTC (rev
1669)
@@ -4,8 +4,8 @@
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-check-fsui
# VALGRIND = 300
-HELLOEXPIRES = 60
-LOGLEVEL = ERROR
+HELLOEXPIRES = 60
+LOGLEVEL = DEBUG
LOGFILE = $GNUNETD_HOME/logs
KEEPLOG = 0
PIDFILE = $GNUNETD_HOME/gnunetd.pid
Modified: GNUnet/src/applications/fs/fsui/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/downloadtest.c 2005-08-14 20:58:51 UTC
(rev 1668)
+++ GNUnet/src/applications/fs/fsui/downloadtest.c 2005-08-14 23:40:07 UTC
(rev 1669)
@@ -46,7 +46,7 @@
NULL));
FREENONNULL(setConfigurationString("GNUNET",
"LOGLEVEL",
- "ERROR"));
+ "DEBUG"));
FREENONNULL(setConfigurationString("GNUNET",
"GNUNETD-CONFIG",
"check.conf"));
@@ -73,6 +73,7 @@
}
static volatile enum FSUI_EventType lastEvent;
+static volatile enum FSUI_EventType waitForEvent;
static struct FSUI_Context * ctx;
static void eventCallback(void * cls,
@@ -95,22 +96,39 @@
case FSUI_download_progress:
printf("Download is progressing...\n");
break;
+ case FSUI_unindex_progress:
+ printf("Unindex is progressing...\n");
+ break;
case FSUI_unindex_complete:
printf("Unindex complete.\n");
break;
+ case FSUI_unindex_error:
+ case FSUI_upload_error:
+ case FSUI_download_error:
+ case FSUI_search_error:
+ errexit("Received ERROR: %d\n",
+ event->type);
default:
+ printf("Unexpected event: %d\n",
+ event->type);
break;
}
- if (lastEvent == FSUI_download_complete)
+ if (lastEvent == waitForEvent)
return; /* ignore all other events */
lastEvent = event->type;
if (event->type == FSUI_search_result) {
+ char * u;
+
fn = makeName(43);
- printf("Download started.\n");
- FSUI_startDownload(ctx,
- 0,
- event->data.SearchResult.fi.uri,
- fn);
+ u = ECRS_uriToString(event->data.SearchResult.fi.uri);
+ printf("Download started: %s.\n", u);
+ FREE(u);
+ if (OK !=
+ FSUI_startDownload(ctx,
+ 0,
+ event->data.SearchResult.fi.uri,
+ fn))
+ errexit("Failed to start download.\n");
FREE(fn);
suspendRestart = 1;
}
@@ -136,7 +154,7 @@
argv,
&parseCommandLine))
return -1;
-#if 1
+#if 0
daemon = startGNUnetDaemon(NO);
GNUNET_ASSERT(daemon > 0);
#else
@@ -161,6 +179,7 @@
meta = ECRS_createMetaData();
kuri = FSUI_parseListKeywordURI(2,
(const char**)keywords);
+ waitForEvent = FSUI_upload_complete;
CHECK(OK ==
FSUI_upload(ctx,
fn,
@@ -175,7 +194,7 @@
prog = 0;
while (lastEvent != FSUI_upload_complete) {
prog++;
- CHECK(prog < 10000);
+ CHECK(prog < 1000);
gnunet_util_sleep(50 * cronMILLIS);
}
SNPRINTF(keyword,
@@ -185,30 +204,41 @@
_("AND"),
keywords[1]);
uri = FSUI_parseCharKeywordURI(keyword);
+ waitForEvent = FSUI_download_complete;
CHECK(OK == FSUI_startSearch(ctx,
0,
uri));
prog = 0;
while (lastEvent != FSUI_download_complete) {
prog++;
- CHECK(prog < 100000);
+ CHECK(prog < 10000);
gnunet_util_sleep(50 * cronMILLIS);
if (suspendRestart > 0) {
suspendCron();
+#if 0
FSUI_stop(ctx); /* download possibly incomplete
at this point, thus testing resume */
ctx = FSUI_start("fsuidownloadtest",
YES,
&eventCallback,
NULL);
+#endif
resumeCron();
suspendRestart--;
}
}
CHECK(OK == FSUI_stopSearch(ctx,
uri));
+ waitForEvent = FSUI_unindex_complete;
CHECK(OK == FSUI_unindex(ctx, fn));
-
+ prog = 0;
+ while (lastEvent != FSUI_unindex_complete) {
+ prog++;
+ CHECK(prog < 1000);
+ gnunet_util_sleep(50 * cronMILLIS);
+ CHECK(lastEvent != FSUI_unindex_error);
+ }
+ CHECK(lastEvent == FSUI_unindex_complete);
/* END OF TEST CODE */
FAILURE:
if (fn != NULL) {
Modified: GNUnet/src/applications/fs/fsui/search.c
===================================================================
--- GNUnet/src/applications/fs/fsui/search.c 2005-08-14 20:58:51 UTC (rev
1668)
+++ GNUnet/src/applications/fs/fsui/search.c 2005-08-14 23:40:07 UTC (rev
1669)
@@ -67,11 +67,15 @@
for (i=0;i<pos->sizeResultsReceived;i++)
if (ECRS_equalsUri(fi->uri,
pos->resultsReceived[i].uri)) {
+ LOG(LOG_DEBUG,
+ "Received search result that I have seen before.\n");
return OK; /* seen before */
}
if (pos->numberOfURIKeys > 1) {
if (key == NULL) {
BREAK();
+ LOG(LOG_DEBUG,
+ "Received search result without key to decrypt.\n");
return SYSERR;
}
for (i=0;i<pos->sizeUnmatchedResultsReceived;i++) {
@@ -81,9 +85,13 @@
for (j=0;j<rp->matchingKeyCount;j++)
if (equalsHashCode512(key,
&rp->matchingKeys[j])) {
+ LOG(LOG_DEBUG,
+ "Received search result that I have seen before (missing
keyword to show client).\n");
return OK;
}
if (rp->matchingKeyCount + 1 == pos->numberOfURIKeys) {
+ LOG(LOG_DEBUG,
+ "Received search result (showing client)!\n");
GROW(rp->matchingKeys,
rp->matchingKeyCount,
0);
@@ -102,6 +110,9 @@
rp->matchingKeyCount,
rp->matchingKeyCount+1);
rp->matchingKeys[rp->matchingKeyCount-1] = *key;
+ LOG(LOG_DEBUG,
+ "Received search result (waiting for more %u keys before showing
client).\n",
+ pos->numberOfURIKeys - rp->matchingKeyCount);
return OK;
}
}
@@ -118,8 +129,13 @@
rp->matchingKeyCount,
1);
rp->matchingKeys[0] = *key;
+ LOG(LOG_DEBUG,
+ "Received search result (waiting for %u more keys before showing
client).\n",
+ pos->numberOfURIKeys - rp->matchingKeyCount);
return OK;
} else {
+ LOG(LOG_DEBUG,
+ "Received search result (showing client)!\n");
processResult(fi,
pos);
}
Modified: GNUnet/src/applications/fs/fsui/unindex.c
===================================================================
--- GNUnet/src/applications/fs/fsui/unindex.c 2005-08-14 20:58:51 UTC (rev
1668)
+++ GNUnet/src/applications/fs/fsui/unindex.c 2005-08-14 23:40:07 UTC (rev
1669)
@@ -84,9 +84,13 @@
event.type = FSUI_unindex_error;
event.data.message = _("Unindex failed.\n");
}
+ utc->ctx->ecb(utc->ctx->ecbClosure,
+ &event);
FREE(utc->filename);
utc->tl->isDone = YES;
FREE(utc);
+ LOG(LOG_DEBUG,
+ "FSUI unindexThread exits.\n");
return NULL;
}
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2005-08-14 20:58:51 UTC (rev
1668)
+++ GNUnet/src/applications/fs/fsui/upload.c 2005-08-14 23:40:07 UTC (rev
1669)
@@ -364,8 +364,6 @@
event.type = FSUI_upload_error;
event.data.message = _("Upload failed.\n");
}
- utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
if (utc->meta == NULL)
utc->meta = ECRS_createMetaData();
else
@@ -402,15 +400,11 @@
if (ret != OK) {
event.type = FSUI_upload_error;
event.data.message = _("Upload failed.\n");
- utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
} /* for success, uploadDirectory sends event already! */
utc->filename = NULL;
} else {
event.type = FSUI_upload_error;
event.data.message = _("Cannot upload directory without using
recursion.\n");
- utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
}
if (ret == OK) { /* publish top-level advertisements */
fi.meta = utc->meta;
@@ -456,6 +450,8 @@
FSUI_publishToCollection(utc->ctx,
&fi);
+ utc->ctx->ecb(utc->ctx->ecbClosure,
+ &event);
if (uri != NULL)
ECRS_freeUri(uri);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1669 - GNUnet/src/applications/fs/fsui,
grothoff <=