[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3510 - GNUnet/src/applications/fs/fsui
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3510 - GNUnet/src/applications/fs/fsui |
Date: |
Fri, 20 Oct 2006 13:12:41 -0700 (PDT) |
Author: grothoff
Date: 2006-10-20 13:12:38 -0700 (Fri, 20 Oct 2006)
New Revision: 3510
Modified:
GNUnet/src/applications/fs/fsui/check.conf
GNUnet/src/applications/fs/fsui/downloadtest.c
GNUnet/src/applications/fs/fsui/upload.c
Log:
fx
Modified: GNUnet/src/applications/fs/fsui/check.conf
===================================================================
--- GNUnet/src/applications/fs/fsui/check.conf 2006-10-20 18:52:30 UTC (rev
3509)
+++ GNUnet/src/applications/fs/fsui/check.conf 2006-10-20 20:12:38 UTC (rev
3510)
@@ -1,6 +1,7 @@
# This is the configuration for the GNUnet daemon when running
# the test in this directory (make check).
+GNUNETD_HOME = /tmp/gnunet-check-fsui
[GNUNETD]
GNUNETD_HOME = /tmp/gnunet-check-fsui
# VALGRIND = 300
Modified: GNUnet/src/applications/fs/fsui/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/downloadtest.c 2006-10-20 18:52:30 UTC
(rev 3509)
+++ GNUnet/src/applications/fs/fsui/downloadtest.c 2006-10-20 20:12:38 UTC
(rev 3510)
@@ -72,6 +72,12 @@
char * fn;
switch(event->type) {
+ case FSUI_search_suspended:
+ search = NULL;
+ break;
+ case FSUI_download_suspended:
+ download = NULL;
+ break;
case FSUI_search_resumed:
#if DEBUG_VERBOSE
printf("Search resuming\n");
@@ -170,8 +176,6 @@
break;
case FSUI_unindex_suspended:
case FSUI_upload_suspended:
- case FSUI_download_suspended:
- case FSUI_search_suspended:
#if DEBUG_VERBOSE
fprintf(stderr,
"Received SUSPENDING: %d\n",
@@ -180,6 +184,12 @@
break;
case FSUI_upload_started:
case FSUI_upload_stopped:
+ case FSUI_download_started:
+ case FSUI_download_stopped:
+ case FSUI_search_started:
+ case FSUI_search_stopped:
+ case FSUI_unindex_started:
+ case FSUI_unindex_stopped:
break;
default:
printf("Unexpected event: %d\n",
@@ -313,11 +323,8 @@
#endif
FSUI_stop(ctx); /* download possibly incomplete
at this point, thus testing resume */
- /* FIXME: this should be done in
- "suspend" event handler -- once event is implemented! */
- search = NULL;
- download = NULL;
-
+ CHECK(search == NULL);
+ CHECK(download == NULL);
ctx = FSUI_start(NULL,
cfg,
"fsuidownloadtest",
@@ -356,9 +363,12 @@
FREE(fn);
}
if (ctx != NULL) {
- if (search != NULL)
+ if (search != NULL) {
+ FSUI_abortSearch(ctx,
+ search);
FSUI_stopSearch(ctx,
search);
+ }
if (unindex != NULL)
FSUI_stopUnindex(ctx,
unindex);
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2006-10-20 18:52:30 UTC (rev
3509)
+++ GNUnet/src/applications/fs/fsui/upload.c 2006-10-20 20:12:38 UTC (rev
3510)
@@ -320,9 +320,12 @@
static void freeUploadList(struct FSUI_UploadList * ul) {
struct FSUI_UploadList * next;
+ struct FSUI_Context * ctx;
+ ctx = ul->shared->ctx;
while (ul->child != NULL)
freeUploadList(ul->child);
+ MUTEX_LOCK(ctx->lock);
FREE(ul->filename);
if (ul->keywords != NULL)
ECRS_freeUri(ul->keywords);
@@ -333,6 +336,7 @@
next = ul->parent->child;
if (next == NULL) {
GE_BREAK(NULL, 0);
+ MUTEX_UNLOCK(ctx->lock);
return;
}
if (next == ul) {
@@ -342,12 +346,14 @@
next = next->next;
if (next == NULL) {
GE_BREAK(NULL, 0);
+ MUTEX_UNLOCK(ctx->lock);
return;
}
}
next->next = ul->next;
}
FREE(ul);
+ MUTEX_UNLOCK(ctx->lock);
}
static struct FSUI_UploadList *
@@ -377,11 +383,8 @@
parent);
FREE(filename);
ECRS_freeMetaData(md);
- if (child == NULL)
- return SYSERR;
- GE_ASSERT(NULL, child->next == NULL);
- child->next = parent->child;
- parent->child = child;
+ if (child == NULL)
+ return SYSERR;
return OK;
}
@@ -467,7 +470,7 @@
static void freeShared(struct FSUI_UploadShared * shared) {
ECRS_freeUri(shared->global_keywords);
EXTRACTOR_removeAll(shared->extractors);
- FREE(shared->extractor_config);
+ FREENONNULL(shared->extractor_config);
FREE(shared);
}
@@ -581,29 +584,10 @@
int FSUI_stopUpload(struct FSUI_Context * ctx,
struct FSUI_UploadList * ul) {
void * unused;
- FSUI_UploadList * prev;
struct FSUI_UploadShared * shared;
GE_ASSERT(ctx->ectx, ul != NULL);
GE_ASSERT(ctx->ectx, ul->parent == &ctx->activeUploads);
- MUTEX_LOCK(ctx->lock);
- prev = ctx->activeUploads.child;
- while ( (prev != ul) &&
- (prev != NULL) &&
- (prev->next != ul) )
- prev = prev->next;
- if (prev == NULL) {
- MUTEX_UNLOCK(ctx->lock);
- GE_LOG(ctx->ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
- "FSUI_stopUpload failed to locate upload.\n");
- return SYSERR;
- }
- if (prev == ul)
- ul->parent->child = ul->next; /* first child of parent */
- else
- prev->next = ul->next; /* not first child */
- MUTEX_UNLOCK(ctx->lock);
PTHREAD_JOIN(ul->shared->handle,
&unused);
signalUploadStopped(ul, 1);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3510 - GNUnet/src/applications/fs/fsui,
grothoff <=