[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r896 - in GNUnet: contrib src/applications/fs/fsui src/appl
From: |
grothoff |
Subject: |
[GNUnet-SVN] r896 - in GNUnet: contrib src/applications/fs/fsui src/applications/fs/lib src/util |
Date: |
Sat, 11 Jun 2005 02:11:22 -0700 (PDT) |
Author: grothoff
Date: 2005-06-11 02:11:14 -0700 (Sat, 11 Jun 2005)
New Revision: 896
Modified:
GNUnet/contrib/gnunet.root
GNUnet/src/applications/fs/fsui/upload.c
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/util/generate
Log:
fixes
Modified: GNUnet/contrib/gnunet.root
===================================================================
--- GNUnet/contrib/gnunet.root 2005-06-10 22:04:27 UTC (rev 895)
+++ GNUnet/contrib/gnunet.root 2005-06-11 09:11:14 UTC (rev 896)
@@ -1,3 +1,9 @@
+#
+# (first two lines of this file are generated by gnunetd,
+# see src/util/generate in the SVN source code! They will
+# set the first section to [GNUNETD] and also define
+# the GNUNETD_HOME directory (see explanation below).
+#
# This is the configuration for the GNUnet daemon, gnunetd.
# Copy this file to "/etc/gnunet.conf" if you are root.
# For any other location, you must explicitly tell gnunetd
@@ -29,7 +35,6 @@
#########################################
# Options for the GNUnet server, gnunetd
#########################################
-[GNUNETD]
# This line gives the root-directory of the GNUnet installation. Make
# sure there is some space left in that directory. :-) Users inserting
@@ -37,7 +42,7 @@
# up to the (global) quota specified below. Having a few gigabytes
# of free space is recommended.
# Default: GNUNETD_HOME = /var/lib/GNUnet
-GNUNETD_HOME = /var/lib/GNUnet
+# GNUNETD_HOME = /var/lib/GNUnet
# How many minutes is the current IP valid? (GNUnet will sign HELO
# messages with this expiration timeline. If you are on dialup, 60
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2005-06-10 22:04:27 UTC (rev
895)
+++ GNUnet/src/applications/fs/fsui/upload.c 2005-06-11 09:11:14 UTC (rev
896)
@@ -59,7 +59,7 @@
FSUI_ThreadList * tl;
FSUI_Context * ctx;
cron_t start_time;
- DirTrack dir;
+ DirTrack * dir;
} UploadThreadClosure;
/**
@@ -100,9 +100,10 @@
* a directory, upload it and store the uri in *uri.
*/
static int uploadDirectory(UploadThreadClosure * utc,
+ const char * dirName,
+ const DirTrack * backup,
struct ECRS_URI ** uri,
struct ECRS_MetaData ** meta) {
- int i;
char * data;
unsigned long long len;
int ret;
@@ -110,34 +111,31 @@
int lastSlash;
FSUI_Event event;
int handle;
- DirTrack backup;
GNUNET_ASSERT(utc->filename != NULL);
- backup = utc->dir;
- memset(&utc->dir, 0, sizeof(DirTrack));
ret = SYSERR;
if (*meta == NULL)
(*meta) = ECRS_createMetaData();
- lastSlash = strlen(utc->filename)-1;
- if (utc->filename[lastSlash] == DIR_SEPARATOR)
+ lastSlash = strlen(dirName)-1;
+ if (dirName[lastSlash] == DIR_SEPARATOR)
lastSlash--;
while ( (lastSlash > 0) &&
- (utc->filename[lastSlash] != DIR_SEPARATOR))
+ (dirName[lastSlash] != DIR_SEPARATOR))
lastSlash--;
ECRS_delFromMetaData(*meta,
EXTRACTOR_FILENAME,
NULL);
ECRS_addToMetaData(*meta,
EXTRACTOR_FILENAME,
- &utc->filename[lastSlash+1]);
+ &dirName[lastSlash+1]);
ECRS_addToMetaData(*meta,
EXTRACTOR_MIMETYPE,
GNUNET_DIRECTORY_MIME);
if (OK == ECRS_createDirectory(&data,
&len,
- utc->dir.fiCount,
- utc->dir.fis,
+ backup->fiCount,
+ backup->fis,
*meta)) {
utc->main_total += len;
@@ -164,7 +162,7 @@
if (ret == OK) {
event.type = upload_complete;
event.data.UploadComplete.total = utc->main_total;
- event.data.UploadComplete.filename = utc->filename;
+ event.data.UploadComplete.filename = STRDUP(dirName);
event.data.UploadComplete.uri = *uri;
event.data.UploadComplete.eta
= (cron_t) (utc->start_time +
@@ -176,6 +174,7 @@
event.data.UploadComplete.main_filename = utc->main_filename;
utc->ctx->ecb(utc->ctx->ecbClosure,
&event);
+ FREE(event.data.UploadComplete.filename);
utc->main_completed += len;
}
UNLINK(tempName);
@@ -183,15 +182,6 @@
FREE(tempName);
}
- utc->dir = backup;
-
- for (i=0;i<utc->dir.fiCount;i++) {
- ECRS_freeMetaData(utc->dir.fis[i].meta);
- ECRS_freeUri(utc->dir.fis[i].uri);
- }
- GROW(utc->dir.fis,
- utc->dir.fiCount,
- 0);
if (ret != OK) {
ECRS_freeMetaData(*meta);
*meta = NULL;
@@ -250,13 +240,31 @@
utc->extractors);
ret = OK;
} else {
+ DirTrack current;
+ DirTrack * prev;
+ int i;
+
+ memset(¤t, 0, sizeof(DirTrack));
+ prev = utc->dir;
+ utc->dir = ¤t;
scanDirectory(fn,
(DirectoryEntryCallback)&dirEntryCallback,
utc);
meta = NULL;
+ utc->dir = prev;
ret = uploadDirectory(utc,
+ dirName,
+ ¤t,
&uri,
&meta);
+
+ for (i=0;i<current.fiCount;i++) {
+ ECRS_freeMetaData(current.fis[i].meta);
+ ECRS_freeUri(current.fis[i].uri);
+ }
+ GROW(current.fis,
+ current.fiCount,
+ 0);
}
if (ret == OK) {
ECRS_addToMetaData(meta,
@@ -279,13 +287,17 @@
utc->expiration,
uri,
meta);
-
- GROW(utc->dir.fis,
- utc->dir.fiCount,
- utc->dir.fiCount+1);
- utc->dir.fis[utc->dir.fiCount-1].meta = meta;
- utc->dir.fis[utc->dir.fiCount-1].uri = uri;
- FSUI_trackURI(&utc->dir.fis[utc->dir.fiCount-1]);
+ if (utc->dir != NULL) {
+ GROW(utc->dir->fis,
+ utc->dir->fiCount,
+ utc->dir->fiCount+1);
+ utc->dir->fis[utc->dir->fiCount-1].meta = meta;
+ utc->dir->fis[utc->dir->fiCount-1].uri = uri;
+ } else {
+ ECRS_freeMetaData(meta);
+ ECRS_freeUri(uri);
+ }
+ FSUI_trackURI(&utc->dir->fis[utc->dir->fiCount-1]);
}
FREE(fn);
}
@@ -308,7 +320,6 @@
cronTime(&utc->start_time);
utc->main_total = getFileSize(utc->main_filename);
utc->main_completed = 0;
- memset(&utc->dir, 0, sizeof(DirTrack));
ret = SYSERR;
uri = NULL;
@@ -348,13 +359,28 @@
utc->extractors);
utc->filename = NULL;
} else if (utc->isRecursive) {
+ DirTrack current;
+ int i;
+
+ memset(¤t, 0, sizeof(DirTrack));
+ utc->dir = ¤t;
utc->filename = utc->main_filename;
scanDirectory(utc->main_filename,
(DirectoryEntryCallback)&dirEntryCallback,
utc);
ret = uploadDirectory(utc,
+ utc->main_filename,
+ ¤t,
&uri,
&utc->meta);
+ for (i=0;i<current.fiCount;i++) {
+ ECRS_freeMetaData(current.fis[i].meta);
+ ECRS_freeUri(current.fis[i].uri);
+ }
+ GROW(current.fis,
+ current.fiCount,
+ 0);
+
if (ret == OK) {
event.type = upload_complete;
event.data.UploadComplete.total = utc->main_total;
@@ -457,6 +483,7 @@
char * config;
utc = MALLOC(sizeof(UploadThreadClosure));
+ utc->dir = NULL;
utc->anonymityLevel = anonymityLevel;
utc->priority = getConfigurationInt("FS",
"INSERT-PRIORITY");
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2005-06-10 22:04:27 UTC (rev
895)
+++ GNUnet/src/applications/fs/lib/fslib.c 2005-06-11 09:11:14 UTC (rev
896)
@@ -303,7 +303,7 @@
unsigned int size, fnSize;
fnSize = strlen(fn);
- size = sizeof(RequestIndex) + fnSize;
+ size = sizeof(RequestInitIndex) + fnSize;
ri = MALLOC(size);
ri->header.size = htons(size);
ri->header.type = htons(AFS_CS_PROTO_INIT_INDEX);
Modified: GNUnet/src/util/generate
===================================================================
--- GNUnet/src/util/generate 2005-06-10 22:04:27 UTC (rev 895)
+++ GNUnet/src/util/generate 2005-06-11 09:11:14 UTC (rev 896)
@@ -5,15 +5,16 @@
echo "#include <stdio.h>"
echo "#include <unistd.h>"
echo "void " $2 "(FILE * f) {"
-#if [ $2 = 'generate_gnunetd_conf' ]
-#then
-# echo " if (access(\"/var/lib/GNUnet\", X_OK))";
-# echo " fprintf(f, \"GNUNETD_HOME = ~/.gnunet\\n\");";
-# echo " else";
-# echo " fprintf(f, \"GNUNETD_HOME = /var/lib/GNUnet\\n\");";
-#fi
+if [ $2 = 'generate_gnunetd_conf' ]
+then
+ echo " fprintf(f, \"[GNUNETD]\\n\");";
+ echo " if (access(\"/var/lib/GNUnet\", X_OK))";
+ echo " fprintf(f, \"GNUNETD_HOME = ~/.gnunet\\n\");";
+ echo " else";
+ echo " fprintf(f, \"GNUNETD_HOME = /var/lib/GNUnet\\n\");";
+fi
cat $1 | sed \
-e "s/\"/\\\\\"/g" \
-e "s/^/ fprintf(f, \"%s\\\\n\",\"/" \
-e "s/$/\");/"
-echo "}";
\ No newline at end of file
+echo "}";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r896 - in GNUnet: contrib src/applications/fs/fsui src/applications/fs/lib src/util,
grothoff <=