[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3084 - in branches/GNUnet-0.7.0/src: applications/fs/fsui
From: |
durner |
Subject: |
[GNUnet-SVN] r3084 - in branches/GNUnet-0.7.0/src: applications/fs/fsui applications/fs/tools include |
Date: |
Sat, 1 Jul 2006 04:02:36 -0700 (PDT) |
Author: durner
Date: 2006-07-01 04:02:13 -0700 (Sat, 01 Jul 2006)
New Revision: 3084
Modified:
branches/GNUnet-0.7.0/src/applications/fs/fsui/download.c
branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.c
branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.h
branches/GNUnet-0.7.0/src/applications/fs/fsui/search.c
branches/GNUnet-0.7.0/src/applications/fs/fsui/unindex.c
branches/GNUnet-0.7.0/src/applications/fs/fsui/upload.c
branches/GNUnet-0.7.0/src/applications/fs/tools/gnunet-search.c
branches/GNUnet-0.7.0/src/include/gnunet_fsui_lib.h
Log:
support for per-search client data (pointer to a model, for example)
Modified: branches/GNUnet-0.7.0/src/applications/fs/fsui/download.c
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/fsui/download.c 2006-07-01
10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/fsui/download.c 2006-07-01
11:02:13 UTC (rev 3084)
@@ -148,7 +148,8 @@
event.data.DownloadProgress.main_uri = root->uri;
event.data.DownloadProgress.pos = dl;
dl->ctx->ecb(dl->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
if ( (lastBlockOffset == 0) &&
(dl->is_directory == SYSERR) ) {
/* check if this is a directory */
@@ -305,7 +306,8 @@
}
event.data.DownloadError.pos = dl;
dl->ctx->ecb(dl->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
} else {
GNUNET_ASSERT(dl != &dl->ctx->activeDownloads);
while ( (dl != NULL) &&
@@ -326,7 +328,8 @@
event.data.DownloadProgress.main_uri = root->uri;
event.data.DownloadProgress.pos = dl;
dl->ctx->ecb(dl->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
dl = dl->parent;
}
}
Modified: branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.c
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.c 2006-07-01
10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.c 2006-07-01
11:02:13 UTC (rev 3084)
@@ -371,6 +371,7 @@
char * gh;
int fd;
int i;
+ FSUI_Event event;
ret = MALLOC(sizeof(FSUI_Context));
memset(ret, 0, sizeof(FSUI_Context));
@@ -584,6 +585,15 @@
= NO;
list->ctx
= ret;
+
+ /* Get the client application's per-search data */
+ memset(&event, 0, sizeof(FSUI_Event));
+ event.type = FSUI_resuming_search;
+ event.data.SearchResumed.searchURI = list->uri;
+ list->closure = cb(closure,
+ &event,
+ NULL);
+
/* start search thread! */
#if DEBUG_PERSISTENCE
LOG(LOG_DEBUG,
Modified: branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.h
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.h 2006-07-01
10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/fsui/fsui.h 2006-07-01
11:02:13 UTC (rev 3084)
@@ -137,6 +137,10 @@
ResultPending * unmatchedResultsReceived;
+ /**
+ * used by client application
+ */
+ void * closure;
} FSUI_SearchList;
/**
Modified: branches/GNUnet-0.7.0/src/applications/fs/fsui/search.c
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/fsui/search.c 2006-07-01
10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/fsui/search.c 2006-07-01
11:02:13 UTC (rev 3084)
@@ -55,7 +55,8 @@
event.data.SearchResult.fi = *fi;
event.data.SearchResult.searchURI = pos->uri;
pos->ctx->ecb(pos->ctx->ecbClosure,
- &event);
+ &event,
+ pos->closure);
}
static void setNamespaceRoot(const ECRS_FileInfo * fi) {
@@ -233,7 +234,8 @@
*/
int FSUI_startSearch(struct FSUI_Context * ctx,
unsigned int anonymityLevel,
- const struct ECRS_URI * uri) {
+ const struct ECRS_URI * uri,
+ void * closure) {
FSUI_SearchList * pos;
MUTEX_LOCK(&ctx->lock);
@@ -259,6 +261,7 @@
pos->unmatchedResultsReceived = 0;
pos->anonymityLevel = anonymityLevel;
pos->ctx = ctx;
+ pos->closure = closure;
if (0 != PTHREAD_CREATE(&pos->handle,
&searchThread,
pos,
Modified: branches/GNUnet-0.7.0/src/applications/fs/fsui/unindex.c
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/fsui/unindex.c 2006-07-01
10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/fsui/unindex.c 2006-07-01
11:02:13 UTC (rev 3084)
@@ -56,7 +56,8 @@
event.data.UnindexProgress.start_time = utc->start_time;
event.data.UnindexProgress.eta = eta;
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
}
/**
@@ -85,7 +86,8 @@
event.data.message = _("Unindex failed.");
}
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
FREE(utc->filename);
utc->tl->isDone = YES;
FREE(utc);
Modified: branches/GNUnet-0.7.0/src/applications/fs/fsui/upload.c
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/fsui/upload.c 2006-07-01
10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/fsui/upload.c 2006-07-01
11:02:13 UTC (rev 3084)
@@ -108,7 +108,8 @@
event.data.UploadProgress.main_eta = eta; /* huh? */
}
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
}
/**
@@ -199,7 +200,8 @@
event.data.UploadComplete.is_recursive = YES;
event.data.UploadComplete.main_filename = utc->main_filename;
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
FREE(event.data.UploadComplete.filename);
utc->main_completed += len;
}
@@ -266,7 +268,8 @@
event.data.UploadComplete.is_recursive = YES;
event.data.UploadComplete.main_filename = utc->main_filename;
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
meta = ECRS_createMetaData();
ECRS_extractMetaData(meta,
fn,
@@ -275,7 +278,8 @@
event.type = FSUI_upload_error;
event.data.message = _("Upload failed.");
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
meta = NULL;
}
} else {
@@ -504,7 +508,8 @@
&fi);
if (sendEvent)
utc->ctx->ecb(utc->ctx->ecbClosure,
- &event);
+ &event,
+ NULL);
if (uri != NULL)
ECRS_freeUri(uri);
Modified: branches/GNUnet-0.7.0/src/applications/fs/tools/gnunet-search.c
===================================================================
--- branches/GNUnet-0.7.0/src/applications/fs/tools/gnunet-search.c
2006-07-01 10:36:07 UTC (rev 3083)
+++ branches/GNUnet-0.7.0/src/applications/fs/tools/gnunet-search.c
2006-07-01 11:02:13 UTC (rev 3084)
@@ -54,7 +54,8 @@
* Handle the search result.
*/
static void eventCallback(SearchClosure * sc,
- const FSUI_Event * event) {
+ const FSUI_Event * event,
+ void * closure) {
char * uri;
char * filename;
@@ -274,7 +275,8 @@
FSUI_startSearch(ctx,
getConfigurationInt("FS",
"ANONYMITY-RECEIVE"),
- uri)) {
+ uri,
+ NULL)) {
printf(_("Starting search failed. Consult logs.\n"));
} else {
wait_for_shutdown();
Modified: branches/GNUnet-0.7.0/src/include/gnunet_fsui_lib.h
===================================================================
--- branches/GNUnet-0.7.0/src/include/gnunet_fsui_lib.h 2006-07-01 10:36:07 UTC
(rev 3083)
+++ branches/GNUnet-0.7.0/src/include/gnunet_fsui_lib.h 2006-07-01 11:02:13 UTC
(rev 3084)
@@ -112,6 +112,10 @@
*/
FSUI_gnunetd_disconnected,
FSUI_download_suspending,
+ /**
+ * Resume
+ */
+ FSUI_resuming_search
};
/**
@@ -131,6 +135,12 @@
*/
struct ECRS_URI * searchURI;
} SearchResult;
+ struct {
+ /**
+ * The URI of the search we're resuming
+ */
+ struct ECRS_URI * searchURI;
+ } SearchResumed;
/**
* Download Progress information. Also used
* for download_completed event.
@@ -322,8 +332,9 @@
* FSUI guarantees is that only one thread at a time will call the
* callback (so it need not be re-entrant).
*/
-typedef void (*FSUI_EventCallback)(void * cls,
- const FSUI_Event * event);
+typedef void *(*FSUI_EventCallback)(void * cls,
+ const FSUI_Event * event,
+ void * closure);
/**
* Iterator over all namespaces.
@@ -467,7 +478,8 @@
*/
int FSUI_startSearch(struct FSUI_Context * ctx,
unsigned int anonymityLevel,
- const struct ECRS_URI * uri); /* search.c */
+ const struct ECRS_URI * uri,
+ void * closure); /* search.c */
/**
* Stop a search.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3084 - in branches/GNUnet-0.7.0/src: applications/fs/fsui applications/fs/tools include,
durner <=