[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3794 - in GNUnet: . m4 src/applications/fs/ecrs src/applic
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3794 - in GNUnet: . m4 src/applications/fs/ecrs src/applications/fs/lib src/applications/fs/module src/applications/fs/tools src/include src/server src/util/network_client |
Date: |
Sat, 18 Nov 2006 23:05:58 -0800 (PST) |
Author: grothoff
Date: 2006-11-18 23:05:47 -0800 (Sat, 18 Nov 2006)
New Revision: 3794
Modified:
GNUnet/ChangeLog
GNUnet/README
GNUnet/README.debian
GNUnet/m4/Makefile.in
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/applications/fs/module/anonymity.c
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/applications/fs/module/ondemand.c
GNUnet/src/applications/fs/module/ondemand.h
GNUnet/src/applications/fs/tools/gnunet-unindex.c
GNUnet/src/include/gnunet_core.h
GNUnet/src/include/gnunet_protocols.h
GNUnet/src/include/gnunet_util_error.h
GNUnet/src/include/gnunet_util_network.h
GNUnet/src/include/gnunet_util_network_client.h
GNUnet/src/server/core.c
GNUnet/src/server/tcpserver.c
GNUnet/src/server/tcpserver.h
GNUnet/src/util/network_client/tcpio.c
GNUnet/todo
Log:
enhancing logging
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/ChangeLog 2006-11-19 07:05:47 UTC (rev 3794)
@@ -1,3 +1,7 @@
+Sun Nov 19 00:20:14 MST 2006
+ Improved error handling. gnunetd now can communicate
+ text error messages to clients (not just error codes).
+
Wed Nov 15 23:17:36 MST 2006
Fixed expiration time setting. Improved bias of
migration towards valuable content.
Modified: GNUnet/README
===================================================================
--- GNUnet/README 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/README 2006-11-19 07:05:47 UTC (rev 3794)
@@ -25,7 +25,7 @@
For the impatient, here is the list of immediate dependencies for
running GNUnet:
-- libextractor >= 0.5.13
+- libextractor >= 0.5.16
- libgcrypt >= 1.2
- libgmp >= 4.0
- mysql >= 5.0 OR sqlite >= 3.0
Modified: GNUnet/README.debian
===================================================================
--- GNUnet/README.debian 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/README.debian 2006-11-19 07:05:47 UTC (rev 3794)
@@ -1,10 +1,9 @@
-This is a list of debian (sarge) packages that you may want to install
+This is a list of debian (etch) packages that you may want to install
prior to compiling GNUnet.
-Since sarge does not include libextractor 0.5.x, you will also have to
-compile libextractor by hand. The following list of packages (and
-their dependencies) is what is needed for a complete installation of
-GNUnet and libextractor (to the best of our knowledge):
+The following list of packages (and their dependencies) is what is
+needed for a complete installation of GNUnet and libextractor (to the
+best of our knowledge):
=====================================================================
@@ -13,7 +12,6 @@
libtool
gcc
make
-g++ (for libextractor)
intltool
GNUnet library dependencies:
@@ -21,35 +19,35 @@
libgcrypt11-dev
libgmp3-dev
libltdl3-dev
-libgtk2.0-dev
-libsqlite3-dev
-libmysqlclient15-dev
-libncurses5-dev
+guile-1.8-dev
+libextractor-dev
libcurl3-gnutls-dev
-libncursesw5-dev
-dialog
-guile-1.8-dev (out since Feb 2006 - still no debian package!)
-libextractor-dev (unstable required!)
+libsqlite3-dev (recommended)
+libmysqlclient15-dev (optional)
+libncursesw5-dev (optional)
+dialog (optional)
+libglade2-dev (recommended)
+libgtk2.0-dev (recommended)
Additional libextractor dependencies:
-libvorbis-dev
+g++
zlib1g-dev
-python2.3-dev
-libgcj-dev
+libvorbis-dev (recommended)
+python2.3-dev (optional)
+libgcj-dev (optional)
Additional gnunet-gtk dependencies:
-libglade2-dev (unstable required!)
-libnotify-dev
+libnotify-dev (optional)
For running GNUnet with the MySQL database:
mysql-server-5.0
-mysql-client-5.0 (for administration)
+mysql-client-5.0 (optional, for administration)
For Subversion access and compilation:
@@ -61,7 +59,7 @@
For changing gnunet-gtk glade user interface (development):
-glade (unstable required!)
+glade
==============================================
Modified: GNUnet/m4/Makefile.in
===================================================================
--- GNUnet/m4/Makefile.in 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/m4/Makefile.in 2006-11-19 07:05:47 UTC (rev 3794)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -33,6 +33,7 @@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+build_triplet = @build@
host_triplet = @host@
subdir = m4
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
@@ -93,7 +94,6 @@
GMSGFMT = @GMSGFMT@
GNUNETGTK_CFLAGS = @GNUNETGTK_CFLAGS@
GNUNETGTK_LIBS = @GNUNETGTK_LIBS@
-GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
HAVE_DIALOG_FALSE = @HAVE_DIALOG_FALSE@
@@ -168,9 +168,15 @@
XFREEBSD_TRUE = @XFREEBSD_TRUE@
XGETTEXT = @XGETTEXT@
_libcurl_config = @_libcurl_config@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -178,6 +184,8 @@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -185,30 +193,23 @@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
-htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
-localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
-psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
@@ -349,7 +350,7 @@
clean-generic:
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2006-11-19 07:05:47 UTC (rev
3794)
@@ -156,10 +156,11 @@
start = get_time();
memset(&chk, 0, sizeof(CHK));
if (YES != disk_file_test(ectx,
- filename)) {
- GE_LOG(ectx, GE_ERROR | GE_BULK | GE_USER,
- _("`%s' is not a file.\n"),
- filename);
+ filename)) {
+ GE_LOG(ectx,
+ GE_ERROR | GE_BULK | GE_USER,
+ _("`%s' is not a file.\n"),
+ filename);
return SYSERR;
}
if (OK != disk_file_size(ectx,
@@ -175,8 +176,9 @@
}
sock = client_connection_create(ectx, cfg);
if (sock == NULL) {
- GE_LOG(ectx, GE_ERROR | GE_BULK | GE_USER,
- _("Failed to connect to gnunetd."));
+ GE_LOG(ectx,
+ GE_ERROR | GE_BULK | GE_USER,
+ _("Failed to connect to gnunetd."));
return SYSERR;
}
eta = 0;
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/applications/fs/lib/fslib.c 2006-11-19 07:05:47 UTC (rev
3794)
@@ -147,9 +147,10 @@
return NULL;
}
-SEARCH_CONTEXT * FS_SEARCH_makeContext(struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- struct MUTEX * lock) {
+SEARCH_CONTEXT *
+FS_SEARCH_makeContext(struct GE_Context * ectx,
+ struct GC_Configuration * cfg,
+ struct MUTEX * lock) {
SEARCH_CONTEXT * ret;
ret = MALLOC(sizeof(SEARCH_CONTEXT));
@@ -199,15 +200,16 @@
* @param callback method to call for each result
* @param prio priority to use for the search
*/
-SEARCH_HANDLE * FS_start_search(SEARCH_CONTEXT * ctx,
- unsigned int type,
- unsigned int keyCount,
- const HashCode512 * keys,
- unsigned int anonymityLevel,
- unsigned int prio,
- cron_t timeout,
- Datum_Iterator callback,
- void * closure) {
+SEARCH_HANDLE *
+FS_start_search(SEARCH_CONTEXT * ctx,
+ unsigned int type,
+ unsigned int keyCount,
+ const HashCode512 * keys,
+ unsigned int anonymityLevel,
+ unsigned int prio,
+ cron_t timeout,
+ Datum_Iterator callback,
+ void * closure) {
SEARCH_HANDLE * ret;
CS_fs_request_search_MESSAGE * req;
#if DEBUG_FSLIB
Modified: GNUnet/src/applications/fs/module/anonymity.c
===================================================================
--- GNUnet/src/applications/fs/module/anonymity.c 2006-11-17 05:06:18 UTC
(rev 3793)
+++ GNUnet/src/applications/fs/module/anonymity.c 2006-11-19 07:05:47 UTC
(rev 3794)
@@ -62,34 +62,38 @@
&peers,
&sizes,
&timevect)) {
- GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
- _("Failed to get traffic stats.\n"));
+ GE_LOG(ectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ _("Failed to get traffic stats.\n"));
return SYSERR;
}
if (level > 1000) {
if (peers < level / 1000) {
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Not enough cover traffic to satisfy anonymity requirements (%u, %u
peers). "
- "Result dropped.\n",
- level,
- peers);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Not enough cover traffic to satisfy anonymity requirements (%u,
%u peers). "
+ "Result dropped.\n",
+ level,
+ peers);
return SYSERR;
}
if (count < level % 1000) {
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Not enough cover traffic to satisfy anonymity requirements (%u, %u
messages). "
- "Result dropped.\n",
- level,
- count);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Not enough cover traffic to satisfy anonymity requirements (%u,
%u messages). "
+ "Result dropped.\n",
+ level,
+ count);
return SYSERR;
}
} else {
if (count < level) {
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Not enough cover traffic to satisfy anonymity requirements (%u, %u
messages). "
- "Result dropped.\n",
- level,
- count);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Not enough cover traffic to satisfy anonymity requirements (%u,
%u messages). "
+ "Result dropped.\n",
+ level,
+ count);
return SYSERR;
}
}
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/applications/fs/module/fs.c 2006-11-19 07:05:47 UTC (rev
3794)
@@ -292,9 +292,14 @@
#if DEBUG_FS
EncName enc;
#endif
+ struct GE_Context * cectx;
+ cectx = coreAPI->createClientLogContext(GE_USER | GE_EVENTKIND |
GE_ROUTEKIND,
+ sock);
if (ntohs(req->size) < sizeof(CS_fs_request_insert_MESSAGE)) {
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
}
ri = (const CS_fs_request_insert_MESSAGE*) req;
@@ -310,7 +315,9 @@
YES,
&query)) {
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
FREE(datum);
+ GE_free_context(cectx);
return SYSERR;
}
type = getTypeOfBlock(ntohs(ri->header.size) -
sizeof(CS_fs_request_insert_MESSAGE),
@@ -373,6 +380,7 @@
}
FREE(datum);
+ GE_free_context(cectx);
return coreAPI->sendValueToClient(sock,
ret);
}
@@ -386,9 +394,14 @@
char *fn;
CS_fs_request_init_index_MESSAGE *ri;
int fnLen;
+ struct GE_Context * cectx;
+ cectx = coreAPI->createClientLogContext(GE_USER | GE_EVENTKIND |
GE_ROUTEKIND,
+ sock);
if (ntohs(req->size) < sizeof(CS_fs_request_init_index_MESSAGE)) {
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
}
@@ -396,14 +409,17 @@
fnLen = ntohs(ri->header.size) - sizeof(CS_fs_request_init_index_MESSAGE);
#if WINDOWS
- if (fnLen > _MAX_PATH)
+ if (fnLen > _MAX_PATH) {
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
+ }
#endif
fn = MALLOC(fnLen + 1);
strncpy(fn, (char*) &ri[1], fnLen+1);
fn[fnLen] = 0;
-
- ret = ONDEMAND_initIndex(&ri->fileId,
+ ret = ONDEMAND_initIndex(cectx,
+ &ri->fileId,
fn);
FREE(fn);
@@ -413,6 +429,7 @@
"Sending confirmation (%s) of index initialization request to
client\n",
ret == OK ? "success" : "failure");
#endif
+ GE_free_context(cectx);
return coreAPI->sendValueToClient(sock,
ret);
}
@@ -426,13 +443,19 @@
const MESSAGE_HEADER * req) {
int ret;
const CS_fs_request_index_MESSAGE * ri;
+ struct GE_Context * cectx;
+ cectx = coreAPI->createClientLogContext(GE_USER | GE_EVENTKIND |
GE_ROUTEKIND,
+ sock);
if (ntohs(req->size) < sizeof(CS_fs_request_index_MESSAGE)) {
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
}
ri = (const CS_fs_request_index_MESSAGE*) req;
- ret = ONDEMAND_index(datastore,
+ ret = ONDEMAND_index(cectx,
+ datastore,
ntohl(ri->prio),
ntohll(ri->expiration),
ntohll(ri->fileOffset),
@@ -446,6 +469,7 @@
"Sending confirmation (%s) of index request to client\n",
ret == OK ? "success" : "failure");
#endif
+ GE_free_context(cectx);
return coreAPI->sendValueToClient(sock,
ret);
}
@@ -500,9 +524,14 @@
#if DEBUG_FS
EncName enc;
#endif
+ struct GE_Context * cectx;
+ cectx = coreAPI->createClientLogContext(GE_USER | GE_EVENTKIND |
GE_ROUTEKIND,
+ sock);
if (ntohs(req->size) < sizeof(CS_fs_request_delete_MESSAGE)) {
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
}
rd = (const CS_fs_request_delete_MESSAGE*) req;
@@ -522,6 +551,8 @@
&query)) {
FREE(value);
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
}
#if DEBUG_FS
@@ -552,6 +583,7 @@
"Sending confirmation (%s) of delete request to client\n",
ret != SYSERR ? "success" : "failure");
#endif
+ GE_free_context(cectx);
return coreAPI->sendValueToClient(sock,
ret);
}
@@ -563,9 +595,14 @@
const MESSAGE_HEADER * req) {
int ret;
CS_fs_request_unindex_MESSAGE * ru;
+ struct GE_Context * cectx;
+ cectx = coreAPI->createClientLogContext(GE_USER | GE_EVENTKIND |
GE_ROUTEKIND,
+ sock);
if (ntohs(req->size) != sizeof(CS_fs_request_unindex_MESSAGE)) {
GE_BREAK(ectx, 0);
+ GE_BREAK(cectx, 0);
+ GE_free_context(cectx);
return SYSERR;
}
ru = (CS_fs_request_unindex_MESSAGE*) req;
@@ -574,9 +611,11 @@
GE_DEBUG | GE_REQUEST | GE_USER,
"FS received REQUEST UNINDEX\n");
#endif
- ret = ONDEMAND_unindex(datastore,
+ ret = ONDEMAND_unindex(cectx,
+ datastore,
ntohl(ru->blocksize),
&ru->fileId);
+ GE_free_context(cectx);
return coreAPI->sendValueToClient(sock,
ret);
}
Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c 2006-11-17 05:06:18 UTC
(rev 3793)
+++ GNUnet/src/applications/fs/module/ondemand.c 2006-11-19 07:05:47 UTC
(rev 3794)
@@ -114,14 +114,15 @@
* @return SYSERR on error, NO if symlinking failed,
* YES on success
*/
-int ONDEMAND_initIndex(const HashCode512 * fileId,
+int ONDEMAND_initIndex(struct GE_Context * cectx,
+ const HashCode512 * fileId,
const char *fn) {
EncName enc;
char * serverFN;
char unavail_key[256];
HashCode512 linkId;
- if ( (SYSERR == getFileHash(ectx,
+ if ( (SYSERR == getFileHash(cectx,
fn,
&linkId)) ||
(! equalsHashCode512(&linkId,
@@ -140,8 +141,14 @@
(char*)&enc);
UNLINK(serverFN);
if (0 != SYMLINK(fn, serverFN)) {
- GE_LOG_STRERROR_FILE(ectx, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
"symlink", fn);
- GE_LOG_STRERROR_FILE(ectx, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
"symlink", serverFN);
+ GE_LOG_STRERROR_FILE(cectx,
+ GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ "symlink",
+ fn);
+ GE_LOG_STRERROR_FILE(cectx,
+ GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ "symlink",
+ serverFN);
FREE(serverFN);
return NO;
}
@@ -162,7 +169,8 @@
* @return NO if already present, YES on success,
* SYSERR on other error (i.e. datastore full)
*/
-int ONDEMAND_index(Datastore_ServiceAPI * datastore,
+int ONDEMAND_index(struct GE_Context * cectx,
+ Datastore_ServiceAPI * datastore,
unsigned int prio,
cron_t expiration,
unsigned long long fileOffset,
@@ -181,6 +189,7 @@
if (size <= sizeof(DBlock)) {
+ GE_BREAK(cectx, 0);
GE_BREAK(ectx, 0);
return SYSERR;
}
@@ -196,16 +205,16 @@
/* not sym-linked, write content to offset! */
#if DEBUG_ONDEMAND
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Storing on-demand encoded data in `%s'.\n",
- fn);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Storing on-demand encoded data in `%s'.\n",
+ fn);
#endif
- fd = disk_file_open(ectx,
+ fd = disk_file_open(cectx,
fn,
O_LARGEFILE | O_CREAT|O_WRONLY,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); /* 644 */
if(fd == -1) {
- GE_LOG_STRERROR_FILE(ectx,GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
"open", fn);
FREE(fn);
return SYSERR;
}
@@ -218,7 +227,10 @@
if (ret == size - sizeof(DBlock)) {
ret = OK;
} else {
- GE_LOG_STRERROR_FILE(ectx,GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
"write", fn);
+ GE_LOG_STRERROR_FILE(cectx,
+ GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+ "write",
+ fn);
ret = SYSERR;
}
CLOSE(fd);
@@ -249,6 +261,7 @@
size,
&key,
&dsvalue)) {
+ GE_BREAK(cectx, 0);
GE_BREAK(ectx, 0);
} else {
FREE(dsvalue);
@@ -258,7 +271,7 @@
#if DEBUG_ONDEMAND
IF_GELOG(ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
+ GE_DEBUG | GE_REQUEST | GE_USER,
hash2enc(&key, &enc));
GE_LOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
@@ -578,7 +591,8 @@
* up the file properly when computing
* the keys of the odb blocks).
*/
-int ONDEMAND_unindex(Datastore_ServiceAPI * datastore,
+int ONDEMAND_unindex(struct GE_Context * cectx,
+ Datastore_ServiceAPI * datastore,
unsigned int blocksize,
const HashCode512 * fileId) {
char * fn;
@@ -600,20 +614,16 @@
"Removing on-demand encoded data stored in `%s'.\n",
fn);
#endif
- fd = disk_file_open(ectx,
+ fd = disk_file_open(cectx,
fn,
O_RDONLY | O_LARGEFILE,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); /* 644 */
if(fd == -1) {
- GE_LOG_STRERROR_FILE(ectx,
- GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
- "open",
- fn);
FREE(fn);
return SYSERR;
}
pos = 0;
- if (OK != disk_file_size(ectx,
+ if (OK != disk_file_size(cectx,
fn,
&size,
YES)) {
@@ -629,7 +639,7 @@
if (delta != READ(fd,
&block[1],
delta)) {
- GE_LOG_STRERROR_FILE(ectx,
+ GE_LOG_STRERROR_FILE(cectx,
GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
"read",
fn);
@@ -660,20 +670,21 @@
else /* not found */
ret = SYSERR;
if (ret == SYSERR) {
- IF_GELOG(ectx, GE_WARNING | GE_BULK | GE_USER,
- hash2enc(&key,
- &enc));
- GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
- _("Unindexed ODB block `%s' from offset %llu already missing from
datastore.\n"),
- &enc,
- pos);
+ IF_GELOG(cectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ hash2enc(&key,
+ &enc));
+ GE_LOG(ectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ _("Unindexed ODB block `%s' from offset %llu already missing from
datastore.\n"),
+ &enc,
+ pos);
}
pos += delta;
}
FREE(block);
CLOSE(fd);
UNLINK(fn);
-
/* Remove information about unavailability */
hash2enc(fileId,
&enc);
@@ -683,8 +694,6 @@
(char*)&enc);
state->unlink(ectx,
unavail_key);
-
-
FREE(fn);
return OK;
}
Modified: GNUnet/src/applications/fs/module/ondemand.h
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.h 2006-11-17 05:06:18 UTC
(rev 3793)
+++ GNUnet/src/applications/fs/module/ondemand.h 2006-11-19 07:05:47 UTC
(rev 3794)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2001, 2002, 2004, 2005 Christian Grothoff (and other contributing
authors)
+ (C) 2001, 2002, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -38,14 +38,16 @@
* @return SYSERR on error, NO if symlinking failed,
* YES on success
*/
-int ONDEMAND_initIndex(const HashCode512 * fileId,
+int ONDEMAND_initIndex(struct GE_Context * cectx,
+ const HashCode512 * fileId,
const char *fn);
/**
* @return NO if already present, YES on success,
* SYSERR on other error (i.e. datastore full)
*/
-int ONDEMAND_index(Datastore_ServiceAPI * datastore,
+int ONDEMAND_index(struct GE_Context * cectx,
+ Datastore_ServiceAPI * datastore,
unsigned int prio,
cron_t expiration,
unsigned long long fileOffset,
@@ -77,7 +79,8 @@
* up the file properly when computing
* the keys of the odb blocks).
*/
-int ONDEMAND_unindex(Datastore_ServiceAPI * datastore,
+int ONDEMAND_unindex(struct GE_Context * cectx,
+ Datastore_ServiceAPI * datastore,
unsigned int blocksize,
const HashCode512 * fileId);
Modified: GNUnet/src/applications/fs/tools/gnunet-unindex.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-unindex.c 2006-11-17 05:06:18 UTC
(rev 3793)
+++ GNUnet/src/applications/fs/tools/gnunet-unindex.c 2006-11-19 07:05:47 UTC
(rev 3794)
@@ -113,7 +113,7 @@
* @return return 0 for ok, -1 on error
*/
int main(int argc,
- const char ** argv) {
+ char * const * argv) {
static struct FSUI_Context * ctx;
char * filename;
int i;
Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/src/include/gnunet_core.h 2006-11-19 07:05:47 UTC (rev 3794)
@@ -678,8 +678,24 @@
int (*getLastActivityOf)(const PeerIdentity * peer,
cron_t * time);
+ /* here for binary compatibility (for now) */
+
+ /**
+ * Send a message to the client identified by the handle. Note that
+ * the core will typically buffer these messages as much as possible
+ * and only return SYSERR if it runs out of buffers. Returning OK
+ * on the other hand does NOT confirm delivery since the actual
+ * transfer happens asynchronously.
+ */
+ int (*sendErrorMessageToClient)(struct ClientHandle * handle,
+ GE_KIND kind,
+ const char * value);
+
+ struct GE_Context * (*createClientLogContext)(GE_KIND mask,
+ struct ClientHandle * handle);
} CoreAPIForApplication;
+
/**
* Type of the initialization method implemented by GNUnet protocol
* plugins.
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/include/gnunet_protocols.h 2006-11-19 07:05:47 UTC (rev
3794)
@@ -130,7 +130,12 @@
*/
#define CS_PROTO_GET_OPTION_REPLY 3
+/**
+ * gnunetd to client: error message
+ */
+#define CS_PROTO_RETURN_ERROR 4
+
/* ********** CS AFS application messages ********** */
/**
Modified: GNUnet/src/include/gnunet_util_error.h
===================================================================
--- GNUnet/src/include/gnunet_util_error.h 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/include/gnunet_util_error.h 2006-11-19 07:05:47 UTC (rev
3794)
@@ -118,8 +118,8 @@
GE_LogHandler handler,
void * ctx,
GE_CtxFree liberator,
- GE_Confirm confirm);
-
+ GE_Confirm confirm);
+
/**
* Free a log context.
*/
Modified: GNUnet/src/include/gnunet_util_network.h
===================================================================
--- GNUnet/src/include/gnunet_util_network.h 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/include/gnunet_util_network.h 2006-11-19 07:05:47 UTC (rev
3794)
@@ -129,7 +129,24 @@
} RETURN_VALUE_MESSAGE;
+/**
+ * Client-server communication: simple error message
+ */
+typedef struct {
+ /**
+ * The CS header (values: sizeof(CS_returnvalue_MESSAGE) + error-size,
CS_PROTO_RETURN_VALUE)
+ */
+ MESSAGE_HEADER header;
+
+ /**
+ * The return value (network byte order)
+ */
+ GE_KIND kind;
+
+} RETURN_ERROR_MESSAGE;
+
+
/**
* @brief an IPv4 address
*/
Modified: GNUnet/src/include/gnunet_util_network_client.h
===================================================================
--- GNUnet/src/include/gnunet_util_network_client.h 2006-11-17 05:06:18 UTC
(rev 3793)
+++ GNUnet/src/include/gnunet_util_network_client.h 2006-11-19 07:05:47 UTC
(rev 3794)
@@ -146,22 +146,6 @@
int ret);
/**
- * Send a return value that indicates
- * a serious error to the other side.
- *
- * @param sock the TCP socket
- * @param mask GE_MASK
- * @param date date string
- * @param msg message string
- * @return SYSERR on error, OK if the error code was send
- * successfully
- */
-int connection_write_error(struct ClientServerConnection * sock,
- GE_KIND mask,
- const char * date,
- const char * msg);
-
-/**
* Stop gnunetd
*
* Note that returning an error does NOT mean that
Modified: GNUnet/src/server/core.c
===================================================================
--- GNUnet/src/server/core.c 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/src/server/core.c 2006-11-19 07:05:47 UTC (rev 3794)
@@ -532,6 +532,9 @@
applicationCore.isSlotUsed = &isSlotUsed; /* connection.c */
applicationCore.getLastActivityOf = &getLastActivityOf; /* connection.c */
+ applicationCore.sendErrorMessageToClient = &sendTCPErrorToClient; /*
tcpserver.c */
+ applicationCore.createClientLogContext = &createClientLogContext; /*
tcpserver.c */
+
identity = requestService("identity");
if (identity == NULL)
return SYSERR;
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/src/server/tcpserver.c 2006-11-19 07:05:47 UTC (rev 3794)
@@ -501,6 +501,44 @@
return sendToClient(sock,
&rv.header);
}
+
+/**
+ * Send an error message to the caller of a remote call via
+ * TCP.
+ * @param sock the TCP socket
+ * @param message the error message to send via TCP
+ * @return SYSERR on error, OK if the return value was
+ * send successfully
+ */
+int sendTCPErrorToClient(struct ClientHandle * sock,
+ GE_KIND kind,
+ const char * message) {
+ RETURN_ERROR_MESSAGE * rv;
+ size_t msgLen;
+ int ret;
+
+ msgLen = strlen(message);
+ msgLen = ((msgLen + 3) >> 2) << 2;
+ if (msgLen > 60000)
+ msgLen = 60000;
+ rv = MALLOC(sizeof(RETURN_ERROR_MESSAGE) + msgLen);
+ memset(rv,
+ 0,
+ sizeof(RETURN_ERROR_MESSAGE) + msgLen);
+ rv->header.size
+ = htons(sizeof(MESSAGE_HEADER) + msgLen);
+ rv->header.type
+ = htons(CS_PROTO_RETURN_ERROR);
+ rv->kind
+ = htonl(kind);
+ memcpy(&rv[1],
+ message,
+ strlen(message));
+ ret = sendToClient(sock,
+ &rv->header);
+ FREE(rv);
+ return ret;
+}
/**
* Check if a handler is registered for a given
@@ -521,4 +559,27 @@
return 0;
}
+static void freeClientLogContext(void * ctx) { }
+
+static void confirmClientLogContext(void * ctx) { }
+
+static void logClientLogContext(void * ctx,
+ GE_KIND kind,
+ const char * date,
+ const char * msg) {
+ sendTCPErrorToClient(ctx,
+ kind,
+ msg);
+}
+
+struct GE_Context *
+createClientLogContext(GE_KIND mask,
+ struct ClientHandle * handle) {
+ return GE_create_context_callback(mask,
+ &logClientLogContext,
+ handle,
+ &freeClientLogContext,
+ &confirmClientLogContext);
+}
+
/* end of tcpserver.c */
Modified: GNUnet/src/server/tcpserver.h
===================================================================
--- GNUnet/src/server/tcpserver.h 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/src/server/tcpserver.h 2006-11-19 07:05:47 UTC (rev 3794)
@@ -101,6 +101,17 @@
int sendTCPResultToClient(struct ClientHandle * sock,
int ret);
+/**
+ * Send an error message to the caller of a remote call via
+ * TCP.
+ * @param sock the TCP socket
+ * @param message the error message to send via TCP
+ * @return SYSERR on error, OK if the return value was
+ * send successfully
+ */
+int sendTCPErrorToClient(struct ClientHandle * sock,
+ GE_KIND kind,
+ const char * message);
void terminateClientConnection(struct ClientHandle * sock);
@@ -113,5 +124,9 @@
*/
unsigned int isCSHandlerRegistered(unsigned short type);
+struct GE_Context *
+createClientLogContext(GE_KIND mask,
+ struct ClientHandle * handle);
+
#endif
/* end of tcpserver.h */
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2006-11-17 05:06:18 UTC (rev
3793)
+++ GNUnet/src/util/network_client/tcpio.c 2006-11-19 07:05:47 UTC (rev
3794)
@@ -333,50 +333,75 @@
unsigned int pos;
char * buf;
unsigned short size;
+ RETURN_ERROR_MESSAGE * rem;
if (OK != connection_ensure_connected(sock))
return SYSERR;
MUTEX_LOCK(sock->readlock);
- pos = 0;
- res = 0;
- if ( (OK != socket_recv(sock->sock,
- NC_Complete,
- &size,
- sizeof(unsigned short),
- &pos)) ||
- (pos != sizeof(unsigned short)) ) {
- MUTEX_UNLOCK(sock->readlock);
- connection_close_temporarily(sock);
- return SYSERR;
- }
- size = ntohs(size);
- if (size < sizeof(MESSAGE_HEADER)) {
- MUTEX_UNLOCK(sock->readlock);
- connection_close_temporarily(sock);
- return SYSERR; /* invalid header */
- }
-
- buf = MALLOC(size);
- if ( (OK != socket_recv(sock->sock,
- NC_Complete,
- &buf[pos],
- size - pos,
- &pos)) ||
- (pos + sizeof(unsigned short) != size) ) {
- FREE(buf);
- MUTEX_UNLOCK(sock->readlock);
- connection_close_temporarily(sock);
- return SYSERR;
- }
+ while (1) {
+ pos = 0;
+ res = 0;
+ if ( (OK != socket_recv(sock->sock,
+ NC_Complete,
+ &size,
+ sizeof(unsigned short),
+ &pos)) ||
+ (pos != sizeof(unsigned short)) ) {
+ GE_BREAK(sock->ectx, 0);
+ MUTEX_UNLOCK(sock->readlock);
+ connection_close_temporarily(sock);
+ return SYSERR;
+ }
+ size = ntohs(size);
+ if (size < sizeof(MESSAGE_HEADER)) {
+ GE_BREAK(sock->ectx, 0);
+ MUTEX_UNLOCK(sock->readlock);
+ connection_close_temporarily(sock);
+ return SYSERR; /* invalid header */
+ }
+
+ buf = MALLOC(size);
+ if ( (OK != socket_recv(sock->sock,
+ NC_Complete,
+ &buf[pos],
+ size - pos,
+ &pos)) ||
+ (pos + sizeof(unsigned short) != size) ) {
+ GE_BREAK(sock->ectx, 0);
+ FREE(buf);
+ MUTEX_UNLOCK(sock->readlock);
+ connection_close_temporarily(sock);
+ return SYSERR;
+ }
#if DEBUG_TCPIO
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Successfully received %d bytes from TCP socket.\n",
- size);
+ GE_LOG(sock->ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Successfully received %d bytes from TCP socket.\n",
+ size);
#endif
- MUTEX_UNLOCK(sock->readlock);
- *buffer = (MESSAGE_HEADER*) buf;
- (*buffer)->size = htons(size);
+ MUTEX_UNLOCK(sock->readlock);
+ *buffer = (MESSAGE_HEADER*) buf;
+ (*buffer)->size = htons(size);
+
+ if (ntohs((*buffer)->type) != CS_PROTO_RETURN_ERROR)
+ break; /* got actual message! */
+ rem = (RETURN_ERROR_MESSAGE*) *buffer;
+ if (ntohs(rem->header.size) < sizeof(RETURN_ERROR_MESSAGE)) {
+ GE_BREAK(sock->ectx, 0);
+ MUTEX_UNLOCK(sock->readlock);
+ connection_close_temporarily(sock);
+ FREE(buf);
+ return SYSERR;
+ }
+ size = ntohs(rem->header.size) - sizeof(RETURN_ERROR_MESSAGE);
+ GE_LOG(sock->ectx,
+ ntohl(rem->kind),
+ "%*s",
+ size,
+ &rem[1]);
+ FREE(rem);
+ } /* while (1) */
return OK; /* success */
}
@@ -391,6 +416,7 @@
int connection_read_result(struct ClientServerConnection * sock,
int * ret) {
RETURN_VALUE_MESSAGE * rv;
+ size_t size;
rv = NULL;
if (SYSERR == connection_read(sock,
@@ -432,23 +458,4 @@
&rv.header);
}
-/**
- * Send a return value that indicates
- * a serious error to the other side.
- *
- * @param sock the TCP socket
- * @param mask GE_MASK
- * @param date date string
- * @param msg message string
- * @return SYSERR on error, OK if the error code was send
- * successfully
- */
-int connection_write_error(struct ClientServerConnection * sock,
- GE_KIND mask,
- const char * date,
- const char * msg) {
- return SYSERR; /* not implemented! */
-}
-
-
/* end of tcpio.c */
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-11-17 05:06:18 UTC (rev 3793)
+++ GNUnet/todo 2006-11-19 07:05:47 UTC (rev 3794)
@@ -18,29 +18,41 @@
+ uninstall: Remove account
+ libcurl, guile [RCpre0]
* file/socket leak (#955) - possibly fixed
+ * gnunet-setup gtk-wizard problems: [RCpre1]
+ + running gnunet-setup with gtk-wizard should imply running with -d
+ + gnunet-setup wizard looks for INTERFACE/MAXNET*BPS in section LOAD,
+ and GROUP in section GNUNETD but it is not there!
+ + at the end: Unable to change startup process: no such file or directory
+ -- which file (something about gnunet-setup's main run)
+ + also, running gnunet-update fails
+ + error messages about failed accesses to /etc, /etc/init.d/ are
+ printed to console, not to GUI
+ + call to updateTreeModel from gconf_main_post_init
+ is illegal -- setup resources have already been freed
+ (in doOpenEnhConfigurator branch from main method of gnunet-setup)
+ => segfault!
- finish util refactoring:
* error handling: [RCpre1]
- + tcpio
- + fs/module
- + fs/fslib
- + fs/ecrs
- + fs/fsui
+ + fs/fsui: capture ectx errors and convert to event error msgs!
* gnunet-setup: [RCpre1]
+ ncurses wizard
- insert of tar.gz results in filename INSIDE of TGZ being
- possibly (?) used for the filename of the archive!
+ possibly (?) used for the filename of the archive! [RCpre1]
+- indexing of directories with relative path specification
+ results in empty paths being used for public directory
+ name [RCpre1]
- update documentation [RCpre2]
- More testcases: [RCpre3]
- * advertising
* ecrs_core
- * tracekit
* gap (incl. economy)
- * rpc
+ * fs/fsui: recursive uploads and downloads (incl. persistence)
* fs/uritrack
+ * fs/namespaces
* fs/collection
+ * tracekit
+ * advertising
+ * rpc
* make dht tests work (and write more)
- * fs/fsui: recursive uploads and downloads (incl. persistence)
- * fs/namespaces
0.7.2 ['07]:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3794 - in GNUnet: . m4 src/applications/fs/ecrs src/applications/fs/lib src/applications/fs/module src/applications/fs/tools src/include src/server src/util/network_client,
grothoff <=