[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6360 - in GNUnet: . contrib doc/man src/applications/dht/m
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6360 - in GNUnet: . contrib doc/man src/applications/dht/module src/applications/dht/tools src/applications/fs/fsui src/applications/fs/gap src/applications/fs/tools src/applications/rpc src/applications/topology_default src/include src/server |
Date: |
Sun, 17 Feb 2008 21:43:41 -0700 (MST) |
Author: grothoff
Date: 2008-02-17 21:43:41 -0700 (Sun, 17 Feb 2008)
New Revision: 6360
Modified:
GNUnet/contrib/config-client.scm
GNUnet/doc/man/gnunet-auto-share.1
GNUnet/src/applications/dht/module/cs.c
GNUnet/src/applications/dht/module/service.c
GNUnet/src/applications/dht/tools/dht-query.c
GNUnet/src/applications/dht/tools/dht_api.c
GNUnet/src/applications/fs/fsui/fsui.h
GNUnet/src/applications/fs/fsui/serialize.c
GNUnet/src/applications/fs/gap/fs.c
GNUnet/src/applications/fs/gap/fs_dht.c
GNUnet/src/applications/fs/gap/plan.c
GNUnet/src/applications/fs/gap/querymanager.c
GNUnet/src/applications/fs/gap/querymanager.h
GNUnet/src/applications/fs/tools/gnunet-auto-share.c
GNUnet/src/applications/rpc/parameters.c
GNUnet/src/applications/rpc/rpc.c
GNUnet/src/applications/topology_default/topology.c
GNUnet/src/include/gnunet_dht_lib.h
GNUnet/src/include/gnunet_dstore_service.h
GNUnet/src/include/gnunet_rpc_lib.h
GNUnet/src/include/gnunet_rpc_service.h
GNUnet/src/server/connection.c
GNUnet/todo
Log:
daemonizing of gnunet-auto-share and bugfixes
Modified: GNUnet/contrib/config-client.scm
===================================================================
--- GNUnet/contrib/config-client.scm 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/contrib/config-client.scm 2008-02-18 04:43:41 UTC (rev 6360)
@@ -258,9 +258,9 @@
(cons 1 1073741824)
'rare) )
-(define (gnunet-fs-metadata builder)
+(define (gnunet-fs-autoshare-metadata builder)
(builder
- "FS"
+ "GNUNET-AUTO-SHARE"
"METADATA"
(_ "Location of the file specifying metadata for the auto-share directory")
(nohelp)
@@ -270,6 +270,18 @@
'()
'fs-loaded) )
+(define (gnunet-fs-autoshare-log builder)
+ (builder
+ "GNUNET-AUTO-SHARE"
+ "LOGFILE"
+ (_ "Location of the log file for gnunet-auto-share")
+ (nohelp)
+ '()
+ #t
+ "$GNUNET_HOME/gnunet-auto-share.log"
+ '()
+ 'fs-loaded) )
+
(define (fs builder)
(builder
"File-Sharing"
@@ -280,7 +292,8 @@
(fs-extractors builder)
(fs-disable-creation-time builder)
(fs-uri-db-size builder)
- (gnunet-fs-metadata builder)
+ (gnunet-fs-autoshare-metadata builder)
+ (gnunet-fs-autoshare-log builder)
)
#t
#f
Modified: GNUnet/doc/man/gnunet-auto-share.1
===================================================================
--- GNUnet/doc/man/gnunet-auto-share.1 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/doc/man/gnunet-auto-share.1 2008-02-18 04:43:41 UTC (rev 6360)
@@ -1,4 +1,4 @@
-.TH GNUNET-AUTO-SHARE "1" "14 Feb 2008" "GNUnet"
+.TH GNUNET-AUTO-SHARE "1" "17 Feb 2008" "GNUnet"
.SH NAME
gnunet\-auto\-share \- process to share a directory
.SH SYNOPSIS
@@ -72,6 +72,10 @@
default is ~/.gnunet/gnunet.conf).
.TP
+\fB\-d\fR, \fB\-\-debug\fR
+do not detach from the console (for debugging); log messages are written to
stderr.
+
+.TP
\fB\-D\fR, \fB\-\-disable\-direct\fR
Disable direct indexing information that would otherwise refer to
files inside of directories directly. Without \-D, contents can be
@@ -123,15 +127,16 @@
.SH EXAMPLES
.PP
-Use the following command to share the "/home/share/" directory:
+Use the following command to have gnunet\-auto\-share run in the
+background and share the "/home/share/" directory:
- $ nohup gnunet\-auto\-share /home/share/ &
+ $ gnunet\-auto\-share /home/share/
Use the following command to share the "/home/share/" directory
and see the URIs of uploaded files. You can abort the daemon
with CTRL-C:
- $ gnunet\-auto\-share -V /home/share/
+ $ gnunet\-auto\-share -d -V /home/share/
.SH FILES
Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/dht/module/cs.c 2008-02-18 04:43:41 UTC (rev
6360)
@@ -99,11 +99,9 @@
}
static int
-get_result (const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size,
- const char * value,
- void *cls)
+get_result (const GNUNET_HashCode * key,
+ unsigned int type,
+ unsigned int size, const char *value, void *cls)
{
struct DHT_CLIENT_GET_RECORD *record = cls;
CS_dht_request_put_MESSAGE *msg;
@@ -124,11 +122,7 @@
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"`%s' at %s:%d processes reply '%.*s'\n",
- __FUNCTION__,
- __FILE__,
- __LINE__,
- size,
- value);
+ __FUNCTION__, __FILE__, __LINE__, size, value);
#endif
if (GNUNET_OK !=
coreAPI->cs_send_to_client (record->client, &msg->header, GNUNET_YES))
Modified: GNUnet/src/applications/dht/module/service.c
===================================================================
--- GNUnet/src/applications/dht/module/service.c 2008-02-18 03:47:19 UTC
(rev 6359)
+++ GNUnet/src/applications/dht/module/service.c 2008-02-18 04:43:41 UTC
(rev 6360)
@@ -49,7 +49,7 @@
* Function to call for each result.
*/
GNUNET_ResultProcessor callback;
-
+
/**
* Extra argument to callback.
*/
@@ -90,8 +90,7 @@
ret->callback = callback;
ret->cls = cls;
ret->type = type;
- if (GNUNET_OK !=
- GNUNET_DHT_get_start (key, type, callback, cls))
+ if (GNUNET_OK != GNUNET_DHT_get_start (key, type, callback, cls))
{
GNUNET_free (ret);
return NULL;
@@ -105,7 +104,8 @@
static int
dht_get_async_stop (struct GNUNET_DHT_GetHandle *record)
{
- GNUNET_DHT_get_stop (&record->key, record->type, record->callback,
record->cls);
+ GNUNET_DHT_get_stop (&record->key, record->type, record->callback,
+ record->cls);
GNUNET_free (record);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/dht/tools/dht-query.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht-query.c 2008-02-18 03:47:19 UTC
(rev 6359)
+++ GNUnet/src/applications/dht/tools/dht-query.c 2008-02-18 04:43:41 UTC
(rev 6360)
@@ -62,16 +62,11 @@
static int
printCallback (const GNUNET_HashCode * hash,
- unsigned int type,
- unsigned int size,
- const char * data, void *cls)
+ unsigned int type,
+ unsigned int size, const char *data, void *cls)
{
char *key = cls;
- printf ("%s(%s): '%.*s'\n",
- "get",
- key,
- size,
- data);
+ printf ("%s(%s): '%.*s'\n", "get", key, size, data);
return GNUNET_OK;
}
@@ -113,8 +108,7 @@
timeout = 30 * GNUNET_CRON_MINUTES;
if (GNUNET_OK ==
GNUNET_DHT_put (cfg, ectx, &hc, GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
- strlen(value),
- value))
+ strlen (value), value))
{
printf (_("'%s(%s,%s)' succeeded\n"), "put", key, value);
}
Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2008-02-18 04:43:41 UTC (rev
6360)
@@ -99,13 +99,12 @@
}
size = ntohs (reply->size) - sizeof (CS_dht_request_put_MESSAGE);
put = (CS_dht_request_put_MESSAGE *) reply;
- if ( (info->processor != NULL) &&
- (GNUNET_OK != info->processor (&put->key,
- 0 /* unknown! */,
- size,
- (const char*) &put[1],
- info->closure)) )
- info->aborted = GNUNET_YES;
+ if ((info->processor != NULL) &&
+ (GNUNET_OK != info->processor (&put->key, 0 /* unknown! */ ,
+ size,
+ (const char *) &put[1],
+ info->closure)))
+ info->aborted = GNUNET_YES;
info->total++;
GNUNET_free (reply);
}
@@ -203,9 +202,7 @@
GNUNET_DHT_put (struct GNUNET_GC_Configuration *cfg,
struct GNUNET_GE_Context *ectx,
const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size,
- const char * value)
+ unsigned int type, unsigned int size, const char *value)
{
struct GNUNET_ClientServerConnection *sock;
CS_dht_request_put_MESSAGE *req;
@@ -214,16 +211,13 @@
#if DEBUG_DHT_API
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
- "DHT_LIB_put called with value '%.*s'\n",
- size, value);
+ "DHT_LIB_put called with value '%.*s'\n", size, value);
#endif
sock = GNUNET_client_connection_create (ectx, cfg);
if (sock == NULL)
return GNUNET_SYSERR;
- req =
- GNUNET_malloc (sizeof (CS_dht_request_put_MESSAGE) + size);
- req->header.size =
- htons (sizeof (CS_dht_request_put_MESSAGE) + size);
+ req = GNUNET_malloc (sizeof (CS_dht_request_put_MESSAGE) + size);
+ req->header.size = htons (sizeof (CS_dht_request_put_MESSAGE) + size);
req->header.type = htons (GNUNET_CS_PROTO_DHT_REQUEST_PUT);
req->key = *key;
req->type = htonl (type);
Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/fs/fsui/fsui.h 2008-02-18 04:43:41 UTC (rev
6360)
@@ -407,8 +407,8 @@
/**
* Collection related data.
*/
- char * collectionData;
-
+ char *collectionData;
+
unsigned int collectionDataSize;
/**
Modified: GNUnet/src/applications/fs/fsui/serialize.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serialize.c 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/fs/fsui/serialize.c 2008-02-18 04:43:41 UTC (rev
6360)
@@ -180,7 +180,7 @@
return;
}
/* serialize collection data */
- WRITEINT(fd, ctx->collectionDataSize);
+ WRITEINT (fd, ctx->collectionDataSize);
WRITE (fd, ctx->collectionData, ctx->collectionDataSize);
}
Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-02-18 04:43:41 UTC (rev 6360)
@@ -388,9 +388,10 @@
return coreAPI->sendValueToClient (sock, ret);
}
-struct FPPClosure {
+struct FPPClosure
+{
struct GNUNET_ClientHandle *sock;
- struct ResponseList * seen;
+ struct ResponseList *seen;
};
/**
@@ -403,9 +404,9 @@
const GNUNET_DatastoreValue *
value, void *closure, unsigned long long uid)
{
- struct FPPClosure * cls = closure;
+ struct FPPClosure *cls = closure;
struct GNUNET_ClientHandle *sock = cls->sock;
- struct ResponseList * rl;
+ struct ResponseList *rl;
const DBlock *dblock;
CS_fs_reply_content_MESSAGE *msg;
unsigned int size;
@@ -438,10 +439,8 @@
GNUNET_free (msg);
if (type == GNUNET_ECRS_BLOCKTYPE_DATA)
return GNUNET_SYSERR; /* unique response */
- rl = GNUNET_malloc(sizeof(struct ResponseList));
- GNUNET_hash(dblock,
- size,
- &rl->hash);
+ rl = GNUNET_malloc (sizeof (struct ResponseList));
+ GNUNET_hash (dblock, size, &rl->hash);
rl->next = cls->seen;
cls->seen = rl;
return GNUNET_OK;
@@ -456,10 +455,10 @@
static int
handle_cs_query_start_request (struct GNUNET_ClientHandle *sock,
const GNUNET_MessageHeader * req)
-{
+{
static GNUNET_PeerIdentity all_zeros;
struct FPPClosure fpp;
- struct ResponseList * pos;
+ struct ResponseList *pos;
const CS_fs_request_search_MESSAGE *rs;
unsigned int keyCount;
unsigned int type;
@@ -492,7 +491,7 @@
(1 == datastore->get (&rs->query[0],
GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
&fast_path_processor, &fpp)))
- goto CLEANUP;
+ goto CLEANUP;
}
else
datastore->get (&rs->query[0], type, &fast_path_processor, &fpp);
@@ -505,13 +504,13 @@
GNUNET_FS_QUERYMANAGER_start_query (&rs->query[0], keyCount, anonymityLevel,
type, sock,
have_target ? &rs->target : NULL,
- fpp.seen);
- CLEANUP:
+ fpp.seen);
+CLEANUP:
while (fpp.seen != NULL)
{
pos = fpp.seen;
fpp.seen = pos->next;
- GNUNET_free(pos);
+ GNUNET_free (pos);
}
return GNUNET_OK;
}
Modified: GNUnet/src/applications/fs/gap/fs_dht.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs_dht.c 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/fs/gap/fs_dht.c 2008-02-18 04:43:41 UTC (rev
6360)
@@ -130,9 +130,8 @@
*/
static int
response_callback (const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size,
- const char * value, void *cls)
+ unsigned int type,
+ unsigned int size, const char *value, void *cls)
{
struct ActiveRequestRecords *record = cls;
const DBlock *dblock;
Modified: GNUnet/src/applications/fs/gap/plan.c
===================================================================
--- GNUnet/src/applications/fs/gap/plan.c 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/fs/gap/plan.c 2008-02-18 04:43:41 UTC (rev
6360)
@@ -565,7 +565,7 @@
if (total_score == 0)
{
GNUNET_mutex_unlock (GNUNET_FS_lock);
- return GNUNET_NO; /* no peers available */
+ return GNUNET_NO; /* no peers available */
}
entropy = 0;
Modified: GNUnet/src/applications/fs/gap/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/gap/querymanager.c 2008-02-18 03:47:19 UTC
(rev 6359)
+++ GNUnet/src/applications/fs/gap/querymanager.c 2008-02-18 04:43:41 UTC
(rev 6360)
@@ -128,14 +128,14 @@
GNUNET_FS_QUERYMANAGER_start_query (const GNUNET_HashCode * query,
unsigned int key_count,
unsigned int anonymityLevel,
- unsigned int type,
+ unsigned int type,
struct GNUNET_ClientHandle *client,
const GNUNET_PeerIdentity * target,
- const struct ResponseList * seen)
+ const struct ResponseList *seen)
{
struct ClientDataList *cl;
struct RequestList *request;
- const struct ResponseList * pos;
+ const struct ResponseList *pos;
GNUNET_GE_ASSERT (NULL, key_count > 0);
if (stats != NULL)
@@ -153,30 +153,30 @@
request->primary_target = GNUNET_FS_PT_intern (target);
request->response_client = client;
request->policy = GNUNET_FS_RoutingPolicy_ALL;
- memcpy (&request->queries[0], query, sizeof (GNUNET_HashCode) * key_count);
+ memcpy (&request->queries[0], query, sizeof (GNUNET_HashCode) * key_count);
if (seen != NULL)
{
pos = seen;
while (pos != NULL)
- {
- request->bloomfilter_entry_count++;
- pos = pos->next;
- }
- request->bloomfilter_size = compute_bloomfilter_size
(request->bloomfilter_entry_count);
- request->bloomfilter_mutator = GNUNET_random_u32
(GNUNET_RANDOM_QUALITY_WEAK, -1);
- request->bloomfilter = GNUNET_bloomfilter_init (NULL,
- NULL,
- request->bloomfilter_size,
- GAP_BLOOMFILTER_K);
+ {
+ request->bloomfilter_entry_count++;
+ pos = pos->next;
+ }
+ request->bloomfilter_size =
+ compute_bloomfilter_size (request->bloomfilter_entry_count);
+ request->bloomfilter_mutator =
+ GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, -1);
+ request->bloomfilter =
+ GNUNET_bloomfilter_init (NULL, NULL, request->bloomfilter_size,
+ GAP_BLOOMFILTER_K);
if (stats != NULL)
- stats->change(stat_gap_client_bf_updates, 1);
+ stats->change (stat_gap_client_bf_updates, 1);
pos = seen;
while (pos != NULL)
- {
- GNUNET_FS_SHARED_mark_response_seen(request,
- &pos->hash);
- pos = pos->next;
- }
+ {
+ GNUNET_FS_SHARED_mark_response_seen (request, &pos->hash);
+ pos = pos->next;
+ }
}
GNUNET_mutex_lock (GNUNET_FS_lock);
cl = clients;
@@ -192,8 +192,8 @@
}
request->next = cl->requests;
cl->requests = request;
- if ( (GNUNET_YES == GNUNET_FS_PLAN_request (client, 0, request)) &&
- (stats != NULL) )
+ if ((GNUNET_YES == GNUNET_FS_PLAN_request (client, 0, request)) &&
+ (stats != NULL))
stats->change (stat_gap_client_query_injected, 1);
if (request->anonymityLevel == 0)
{
@@ -302,7 +302,7 @@
rl->bloomfilter_size,
GAP_BLOOMFILTER_K);
if (stats != NULL)
- stats->change(stat_gap_client_bf_updates, 1);
+ stats->change (stat_gap_client_bf_updates, 1);
}
else if (rl->bloomfilter_size != bf_size)
{
@@ -314,7 +314,7 @@
&response_bf_iterator,
&ic, bf_size, GAP_BLOOMFILTER_K);
if (stats != NULL)
- stats->change(stat_gap_client_bf_updates, 1);
+ stats->change (stat_gap_client_bf_updates, 1);
}
GNUNET_FS_SHARED_mark_response_seen (rl, &hc);
@@ -456,8 +456,9 @@
(request->last_ttl_used * GNUNET_CRON_SECONDS +
request->last_request_time < now))
{
- if ( (GNUNET_OK == GNUNET_FS_PLAN_request (client->client, 0,
request)) &&
- (stats != NULL) )
+ if ((GNUNET_OK ==
+ GNUNET_FS_PLAN_request (client->client, 0, request))
+ && (stats != NULL))
stats->change (stat_gap_client_query_injected, 1);
}
@@ -500,7 +501,8 @@
stat_gap_client_query_injected =
stats->create (gettext_noop ("# gap client requests injected"));
stat_gap_client_bf_updates =
- stats->create (gettext_noop ("# gap query bloomfilter resizing
updates"));
+ stats->
+ create (gettext_noop ("# gap query bloomfilter resizing updates"));
}
return 0;
}
Modified: GNUnet/src/applications/fs/gap/querymanager.h
===================================================================
--- GNUnet/src/applications/fs/gap/querymanager.h 2008-02-18 03:47:19 UTC
(rev 6359)
+++ GNUnet/src/applications/fs/gap/querymanager.h 2008-02-18 04:43:41 UTC
(rev 6360)
@@ -50,7 +50,7 @@
unsigned int type,
struct GNUNET_ClientHandle *client,
const GNUNET_PeerIdentity * target,
- const struct ResponseList * seen);
+ const struct ResponseList *seen);
/**
* Handle the given response (by forwarding it to
Modified: GNUnet/src/applications/fs/tools/gnunet-auto-share.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-02-18
03:47:19 UTC (rev 6359)
+++ GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-02-18
04:43:41 UTC (rev 6360)
@@ -26,10 +26,21 @@
#include "platform.h"
#include "gnunet_directories.h"
+#include "gnunet_fs_lib.h"
#include "gnunet_fsui_lib.h"
#include "gnunet_util.h"
#include <extractor.h>
+struct FileRecord
+{
+ struct FileRecord *next;
+ char *filename;
+ time_t mtime;
+ time_t last_seen;
+ off_t size;
+ GNUNET_HashCode hc;
+};
+
static int upload_done;
static struct GNUNET_GC_Configuration *cfg;
@@ -46,17 +57,19 @@
static struct GNUNET_ECRS_URI *gloKeywords;
+static struct GNUNET_ClientServerConnection *sock;
+
static unsigned int anonymity = 1;
static unsigned int priority = 365;
static int do_no_direct_references;
-static time_t start;
+static struct FileRecord *records;
-static unsigned int done_pos;
+static int debug_flag;
-static unsigned int current_pos;
+static FILE *myout;
/**
* Print progess message.
@@ -76,27 +89,29 @@
{
fstring =
GNUNET_ECRS_uri_to_string (event->data.UploadCompleted.uri);
- printf (_("Upload of `%s' complete, URI is `%s'.\n"),
- event->data.UploadCompleted.filename, fstring);
+ fprintf (myout,
+ _("Upload of `%s' complete, URI is `%s'.\n"),
+ event->data.UploadCompleted.filename, fstring);
GNUNET_free (fstring);
}
if (ul == event->data.UploadCompleted.uc.pos)
upload_done = GNUNET_YES;
break;
case GNUNET_FSUI_upload_aborted:
- printf (_("\nUpload aborted.\n"));
+ fprintf (myout, _("\nUpload aborted.\n"));
upload_done = GNUNET_YES;
break;
case GNUNET_FSUI_upload_error:
- printf (_("\nError uploading file: %s"),
- event->data.UploadError.message);
+ fprintf (myout,
+ _("\nError uploading file: %s"),
+ event->data.UploadError.message);
upload_done = GNUNET_YES;
break;
case GNUNET_FSUI_upload_started:
case GNUNET_FSUI_upload_stopped:
break;
default:
- printf (_("\nUnexpected event: %d\n"), event->type);
+ fprintf (myout, _("\nUnexpected event: %d\n"), event->type);
GNUNET_GE_BREAK (ectx, 0);
break;
}
@@ -111,6 +126,11 @@
gettext_noop ("set the desired LEVEL of sender-anonymity"),
1, &GNUNET_getopt_configure_set_uint, &anonymity},
GNUNET_COMMAND_LINE_OPTION_CFG_FILE (&cfgFilename), /* -c */
+ {'d', "debug", NULL,
+ gettext_noop ("run in debug mode; gnunet-auto-share will "
+ "not daemonize and error messages will "
+ "be written to stderr instead of a logfile"),
+ 0, &GNUNET_getopt_configure_set_one, &debug_flag},
{'D', "disable-direct", NULL,
gettext_noop
("do not use libextractor to add additional references to directory entries
and/or the published file"),
@@ -130,10 +150,21 @@
GNUNET_COMMAND_LINE_OPTION_END,
};
+static struct FileRecord *
+find_entry (const char *filename)
+{
+ struct FileRecord *pos = records;
+ while ((pos != NULL) && (0 != strcmp (filename, pos->filename)))
+ pos = pos->next;
+ return pos;
+}
+
static int
-find_latest (const char *filename, const char *dirName, void *cls)
+test_run (const char *filename, const char *dirName, void *cls)
{
- time_t *latest = cls;
+ GNUNET_HashCode hc;
+ int *run = cls;
+ struct FileRecord *rec;
struct stat buf;
char *fn;
@@ -146,14 +177,39 @@
strcat (fn, filename);
if (0 != stat (fn, &buf))
{
- printf ("Could not stat `%s': %s\n", fn, strerror (errno));
+ fprintf (myout, "Could not stat `%s': %s\n", fn, strerror (errno));
GNUNET_free (fn);
return GNUNET_OK;
}
- if (*latest < buf.st_mtime)
- *latest = buf.st_mtime;
+ rec = find_entry (filename);
+ if (rec == NULL)
+ {
+ rec = GNUNET_malloc (sizeof (struct FileRecord));
+ rec->next = records;
+ rec->filename = fn;
+ rec->mtime = buf.st_mtime;
+ rec->size = buf.st_size;
+ rec->last_seen = time (NULL);
+ GNUNET_hash_file (NULL, fn, &rec->hc);
+ if (GNUNET_NO == GNUNET_FS_test_indexed (sock, &rec->hc))
+ *run = 1;
+ return GNUNET_SYSERR;
+ }
+ else
+ {
+ rec->last_seen = time (NULL);
+ }
+ if ((rec->mtime != buf.st_mtime) || (rec->size != buf.st_size))
+ {
+ GNUNET_hash_file (NULL, fn, &hc);
+ if (0 != memcmp (&hc, &rec->hc, sizeof (GNUNET_HashCode)))
+ *run = 1;
+ rec->mtime = buf.st_mtime;
+ rec->size = buf.st_size;
+ rec->hc = hc;
+ }
if (S_ISDIR (buf.st_mode))
- GNUNET_disk_directory_scan (ectx, fn, &find_latest, latest);
+ GNUNET_disk_directory_scan (ectx, fn, &test_run, run);
GNUNET_free (fn);
return GNUNET_OK;
}
@@ -206,15 +262,14 @@
static int
-probe_directory (const char *filename, const char *dirName, void *cls)
+probe_directory (const char *filename, const char *dirName, void *unused)
{
- time_t *last = cls;
- time_t latest;
struct stat buf;
struct AddMetadataClosure amc;
struct GNUNET_ECRS_URI *kuri;
char *fn;
char *keys;
+ int run;
if (filename[0] == '.')
return GNUNET_OK;
@@ -225,30 +280,20 @@
strcat (fn, filename);
if (0 != stat (fn, &buf))
{
- printf ("Could not stat `%s': %s\n", fn, strerror (errno));
+ fprintf (myout, "Could not stat `%s': %s\n", fn, strerror (errno));
GNUNET_free (fn);
return GNUNET_OK;
}
- if ((buf.st_mtime < *last) && (!S_ISDIR (buf.st_mode)))
- {
- GNUNET_free (fn);
- return GNUNET_OK;
- }
- latest = buf.st_mtime;
+ run = 0;
if (S_ISDIR (buf.st_mode))
- GNUNET_disk_directory_scan (ectx, fn, &find_latest, &latest);
- if (latest < *last)
+ GNUNET_disk_directory_scan (ectx, fn, &test_run, &run);
+ else
+ test_run (filename, dirName, &run);
+ if (0 == run)
{
GNUNET_free (fn);
return GNUNET_OK;
}
- if ((start > latest) && (current_pos < done_pos))
- {
- GNUNET_free (fn);
- current_pos++;
- return GNUNET_OK;
- }
- done_pos = ++current_pos;
amc.meta = GNUNET_ECRS_meta_data_create ();
amc.filename = filename;
/* attaching a listener will prompt iteration
@@ -277,58 +322,46 @@
return GNUNET_SYSERR;
}
+
/**
- * The main function to auto share directories with GNUnet.
+ * Actual main function.
*
* @param argc number of arguments from the command line
* @param argv command line arguments
* @return return 0 for ok, -1 on error
*/
int
-main (int argc, char *const *argv)
+auto_share_main (const char *argvi)
{
char *dirname;
- int i;
int errorCode;
unsigned long long verbose;
- unsigned long long cfg_start;
- time_t last;
GNUNET_CronTime delay;
char *metafn;
+ struct FileRecord *pos;
+ int filedes[2]; /* pipe between client and parent */
errorCode = 0;
- i = GNUNET_init (argc,
- argv,
- "gnunet-auto-share [OPTIONS] DIRECTORY",
- &cfgFilename, gnunetauto_shareOptions, &ectx, &cfg);
- if (i == -1)
+ if ((GNUNET_NO == debug_flag)
+ && (GNUNET_OK != GNUNET_terminal_detach (ectx, cfg, filedes)))
+ return GNUNET_SYSERR;
+
+ sock = GNUNET_client_connection_create (ectx, cfg);
+ if (sock == NULL)
{
+ fprintf (myout, _("Failed to connect to gnunetd.\n"));
errorCode = -1;
+ if (GNUNET_NO == debug_flag)
+ GNUNET_terminal_detach_complete (ectx, filedes, GNUNET_NO);
goto quit;
}
- if (i != argc - 1)
- {
- printf (_
- ("You must specify one and only one directory for sharing.\n"));
- errorCode = -1;
- goto quit;
- }
- dirname = GNUNET_expand_file_name (ectx, argv[i]);
+ dirname = GNUNET_expand_file_name (ectx, argvi);
GNUNET_GC_get_configuration_value_number (cfg,
"GNUNET",
"VERBOSE", 0, 9999, 0, &verbose);
- if (0 == GNUNET_GC_get_configuration_value_number (cfg,
- "GNUNET-AUTO-SHARE",
- "TIMESTAMP-LAST-RUN", 0,
- -1, 0, &cfg_start))
- {
- last = (time_t) cfg_start;
- }
- else
- last = 0;
metafn = NULL;
GNUNET_GC_get_configuration_value_filename (cfg,
- "FS",
+ "GNUNET-AUTO-SHARE",
"METADATA",
GNUNET_DEFAULT_HOME_DIRECTORY
"/metadata.conf", &metafn);
@@ -340,24 +373,13 @@
&printstatus, &verbose);
/* first insert all of the top-level files or directories */
+ if (GNUNET_NO == debug_flag)
+ GNUNET_terminal_detach_complete (ectx, filedes, GNUNET_YES);
delay = 5 * GNUNET_CRON_SECONDS;
while (GNUNET_NO == GNUNET_shutdown_test ())
{
GNUNET_thread_sleep (250 * GNUNET_CRON_MILLISECONDS);
- start = time (NULL);
- current_pos = 0;
- GNUNET_disk_directory_scan (ectx, dirname, &probe_directory, &last);
- if (ul == NULL)
- {
- last = start;
- done_pos = 0;
- GNUNET_GC_set_configuration_value_number (cfg,
- ectx,
- "GNUNET-AUTO-SHARE",
- "TIMESTAMP-LAST-RUN",
- last);
- GNUNET_GC_write_configuration (cfg, cfgFilename);
- }
+ GNUNET_disk_directory_scan (ectx, dirname, &probe_directory, NULL);
if (GNUNET_YES == upload_done)
{
GNUNET_FSUI_upload_abort (ctx, ul);
@@ -382,8 +404,95 @@
GNUNET_ECRS_uri_destroy (gloKeywords);
GNUNET_free (dirname);
quit:
+ while (records != NULL)
+ {
+ pos = records;
+ records = pos->next;
+ GNUNET_free (pos->filename);
+ GNUNET_free (pos);
+ }
if (meta_cfg != NULL)
GNUNET_GC_free (meta_cfg);
+ if (sock != NULL)
+ GNUNET_client_connection_destroy (sock);
+ return errorCode;
+}
+
+#ifdef MINGW
+/**
+ * Main method of the windows service
+ */
+void WINAPI
+ServiceMain (DWORD argc, LPSTR * argv)
+{
+ GNUNET_CORE_w32_service_main (auto_share_main);
+}
+#endif
+
+
+/**
+ * The main function to auto share directories with GNUnet.
+ *
+ * @param argc number of arguments from the command line
+ * @param argv command line arguments
+ * @return return 0 for ok, -1 on error
+ */
+int
+main (int argc, char *const *argv)
+{
+ int i;
+ int errorCode;
+ char *log_file_name;
+
+ errorCode = 0;
+ i = GNUNET_init (argc,
+ argv,
+ "gnunet-auto-share [OPTIONS] DIRECTORY",
+ &cfgFilename, gnunetauto_shareOptions, &ectx, &cfg);
+ if (i == -1)
+ {
+ errorCode = -1;
+ goto end;
+ }
+ if (i != argc - 1)
+ {
+ fprintf (stderr,
+ _
+ ("You must specify one and only one directory for sharing.\n"));
+ errorCode = -1;
+ goto end;
+ }
+ if (GNUNET_YES == debug_flag)
+ {
+ myout = stdout;
+ }
+ else
+ {
+ GNUNET_GC_get_configuration_value_filename (cfg,
+ "GNUNET-AUTO-SHARE",
+ "LOGFILE",
+ GNUNET_DEFAULT_HOME_DIRECTORY
+ "/gnunet-auto-share.log",
+ &log_file_name);
+ myout = fopen (log_file_name, "a");
+ GNUNET_free (log_file_name);
+ }
+#ifdef MINGW
+ if (GNUNET_GC_get_configuration_value_yesno (cfg,
+ "GNUNET-AUTO-SHARE",
+ "WINSERVICE",
+ GNUNET_NO) == GNUNET_YES)
+ {
+ SERVICE_TABLE_ENTRY DispatchTable[] =
+ { {"gnunet-auto-share", ServiceMain}
+ , {NULL, NULL}
+ };
+ errorCode = (GNStartServiceCtrlDispatcher (DispatchTable) != 0);
+ }
+ else
+#endif
+ errorCode = auto_share_main (argv[i]);
+end:
GNUNET_fini (ectx, cfg);
return errorCode;
}
Modified: GNUnet/src/applications/rpc/parameters.c
===================================================================
--- GNUnet/src/applications/rpc/parameters.c 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/applications/rpc/parameters.c 2008-02-18 04:43:41 UTC (rev
6360)
@@ -32,17 +32,17 @@
/**
* A linked list of parameters to/from an RPC call.
*/
-struct Parameter
+struct Parameter
{
- struct Parameter * next;
- char * name;
- void * data;
+ struct Parameter *next;
+ char *name;
+ void *data;
unsigned int dataLength;
};
-struct GNUNET_RPC_CallParameters
+struct GNUNET_RPC_CallParameters
{
- struct Parameter * list;
+ struct Parameter *list;
};
@@ -54,9 +54,9 @@
struct GNUNET_RPC_CallParameters *
GNUNET_RPC_parameters_create ()
{
- struct GNUNET_RPC_CallParameters * ret;
+ struct GNUNET_RPC_CallParameters *ret;
- ret = GNUNET_malloc(sizeof(struct GNUNET_RPC_CallParameters));
+ ret = GNUNET_malloc (sizeof (struct GNUNET_RPC_CallParameters));
ret->list = NULL;
return ret;
}
@@ -69,7 +69,7 @@
* @param param The RPC parameter structure to be freed
*/
void
-GNUNET_RPC_parameters_destroy (struct GNUNET_RPC_CallParameters * param)
+GNUNET_RPC_parameters_destroy (struct GNUNET_RPC_CallParameters *param)
{
if (param == NULL)
return;
@@ -81,7 +81,7 @@
GNUNET_free (p->data);
GNUNET_free (p);
}
- GNUNET_free(param);
+ GNUNET_free (param);
}
/**
@@ -89,8 +89,8 @@
* GNUNET_RPC_parameters_get_serialized_size(param) bytes of memory.
*/
void
-GNUNET_RPC_parameters_serialize (const struct GNUNET_RPC_CallParameters *
param,
- char *target)
+GNUNET_RPC_parameters_serialize (const struct GNUNET_RPC_CallParameters
+ *param, char *target)
{
const struct Parameter *pos;
unsigned int dataLength;
@@ -103,12 +103,12 @@
off = 0;
dataLength = 0;
pos = param->list;
- while (pos != NULL)
+ while (pos != NULL)
{
memcpy (&target[off], pos->name, strlen (pos->name) + 1);
off += strlen (pos->name) + 1;
- dataLength = htonl(pos->dataLength);
- memcpy(&target[off], &dataLength, sizeof(unsigned int));
+ dataLength = htonl (pos->dataLength);
+ memcpy (&target[off], &dataLength, sizeof (unsigned int));
off += sizeof (unsigned int);
memcpy (&target[off], pos->data, pos->dataLength);
off += pos->dataLength;
@@ -142,20 +142,16 @@
GNUNET_RPC_parameters_destroy (ret);
return NULL;
}
- memcpy(&dataLength,
- &buffer[pos],
- sizeof(unsigned int));
- dataLength = ntohl(dataLength);
+ memcpy (&dataLength, &buffer[pos], sizeof (unsigned int));
+ dataLength = ntohl (dataLength);
pos += sizeof (unsigned int);
if ((pos + dataLength < pos) || (pos + dataLength > size))
{
GNUNET_RPC_parameters_destroy (ret);
return NULL;
}
- GNUNET_RPC_parameters_add (ret,
- &buffer[xpos],
- dataLength,
- &buffer[pos]);
+ GNUNET_RPC_parameters_add (ret,
+ &buffer[xpos], dataLength, &buffer[pos]);
pos += dataLength;
}
return ret;
@@ -165,7 +161,8 @@
* How many bytes are required to serialize the param array?
*/
size_t
-GNUNET_RPC_parameters_get_serialized_size (const struct
GNUNET_RPC_CallParameters * param)
+GNUNET_RPC_parameters_get_serialized_size (const struct
+ GNUNET_RPC_CallParameters * param)
{
const struct Parameter *pos;
size_t off;
@@ -174,14 +171,15 @@
return 0;
off = 0;
pos = param->list;
- while (pos != NULL) {
+ while (pos != NULL)
{
- off += strlen (pos->name) + 1;
- off += sizeof (unsigned int);
- off += pos->dataLength;
- pos = pos->next;
+ {
+ off += strlen (pos->name) + 1;
+ off += sizeof (unsigned int);
+ off += pos->dataLength;
+ pos = pos->next;
+ }
}
- }
return off;
}
@@ -192,7 +190,7 @@
* @return The number of parameters
*/
unsigned int
-GNUNET_RPC_parameters_count (const struct GNUNET_RPC_CallParameters * param)
+GNUNET_RPC_parameters_count (const struct GNUNET_RPC_CallParameters *param)
{
const struct Parameter *pos;
unsigned int s;
@@ -221,7 +219,7 @@
*/
void
-GNUNET_RPC_parameters_add (struct GNUNET_RPC_CallParameters * param,
+GNUNET_RPC_parameters_add (struct GNUNET_RPC_CallParameters *param,
const char *name, unsigned int dataLength,
const void *data)
{
@@ -251,7 +249,7 @@
{
pos = param->list;
while (pos->next != NULL)
- pos = pos->next;
+ pos = pos->next;
pos->next = p;
}
}
@@ -264,10 +262,11 @@
* @return GNUNET_SYSERR on error
*/
int
-GNUNET_RPC_parameters_get_value_by_name (const struct
GNUNET_RPC_CallParameters * param,
+GNUNET_RPC_parameters_get_value_by_name (const struct
+ GNUNET_RPC_CallParameters *param,
const char *name,
unsigned int *dataLength,
- void const * *value)
+ void const **value)
{
const struct Parameter *p;
@@ -294,7 +293,8 @@
* @param value set to the value of the parameter
*/
int
-GNUNET_RPC_parameters_get_value_by_index (const struct
GNUNET_RPC_CallParameters * param,
+GNUNET_RPC_parameters_get_value_by_index (const struct
+ GNUNET_RPC_CallParameters *param,
unsigned int i,
unsigned int *dataLength,
void const **value)
@@ -304,8 +304,7 @@
if (param == NULL)
return GNUNET_SYSERR;
p = param->list;
- while ( (i > 0) &&
- (p != NULL) )
+ while ((i > 0) && (p != NULL))
{
i--;
p = p->next;
Modified: GNUnet/src/applications/rpc/rpc.c
===================================================================
--- GNUnet/src/applications/rpc/rpc.c 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/src/applications/rpc/rpc.c 2008-02-18 04:43:41 UTC (rev 6360)
@@ -72,12 +72,12 @@
* Timestamp (of the sender of this message).
*/
GNUNET_Int32Time timestamp;
-
+
/**
* Sequence number (of the initiator).
*/
unsigned int sequenceNumber;
-
+
/**
* How important is this message?
*/
@@ -119,9 +119,9 @@
*/
struct GNUNET_RPC_CallHandle
{
- struct GNUNET_RPC_CallHandle * next;
+ struct GNUNET_RPC_CallHandle *next;
- struct GNUNET_RPC_CallHandle * prev;
+ struct GNUNET_RPC_CallHandle *prev;
/**
* The message we are transmitting. NULL
@@ -134,8 +134,8 @@
/**
* Name of the local RPC function that we
* have been calling.
- */
- char * function_name;
+ */
+ char *function_name;
/**
* For which peer is this response?
@@ -189,9 +189,9 @@
*/
struct GNUNET_RPC_RequestHandle
{
- struct GNUNET_RPC_RequestHandle * next;
+ struct GNUNET_RPC_RequestHandle *next;
- struct GNUNET_RPC_RequestHandle * prev;
+ struct GNUNET_RPC_RequestHandle *prev;
/**
* The message we are transmitting.
@@ -203,7 +203,7 @@
*/
GNUNET_RPC_AsynchronousCompletionCallback callback;
- void * cls;
+ void *cls;
/**
* To which peer are we sending the request?
@@ -229,7 +229,7 @@
* Last time the message was sent.
*/
GNUNET_CronTime lastAttempt;
-
+
/**
* The sequence number of this RPC.
*/
@@ -256,7 +256,7 @@
*/
struct RegisteredRPC
{
- struct RegisteredRPC * next;
+ struct RegisteredRPC *next;
/**
* Name of the RPC.
@@ -271,7 +271,7 @@
/**
* Extra argument to async_callback.
*/
- void * cls;
+ void *cls;
};
/**
@@ -321,8 +321,7 @@
*/
static int
RPC_register (const char *name,
- GNUNET_RPC_AsynchronousFunction callback,
- void * cls)
+ GNUNET_RPC_AsynchronousFunction callback, void *cls)
{
struct RegisteredRPC *rrpc;
@@ -345,7 +344,7 @@
}
rrpc = rrpc->next;
}
- rrpc = GNUNET_malloc(sizeof(struct RegisteredRPC));
+ rrpc = GNUNET_malloc (sizeof (struct RegisteredRPC));
rrpc->name = GNUNET_strdup (name);
rrpc->async_callback = callback;
rrpc->cls = cls;
@@ -365,8 +364,7 @@
*/
static int
RPC_unregister (const char *name,
- GNUNET_RPC_AsynchronousFunction callback,
- void * cls)
+ GNUNET_RPC_AsynchronousFunction callback, void *cls)
{
struct RegisteredRPC *pos;
struct RegisteredRPC *prev;
@@ -378,22 +376,22 @@
pos = list_of_callbacks;
while (pos != NULL)
{
- if ( (0 == strcmp (pos->name, name)) &&
- (pos->async_callback == callback) &&
- (pos->cls == cls) )
- {
- if (prev == NULL)
- list_of_callbacks = pos->next;
- else
- prev->next = pos->next;
- GNUNET_free(pos->name);
- GNUNET_free(pos);
+ if ((0 == strcmp (pos->name, name)) &&
+ (pos->async_callback == callback) && (pos->cls == cls))
+ {
+ if (prev == NULL)
+ list_of_callbacks = pos->next;
+ else
+ prev->next = pos->next;
+ GNUNET_free (pos->name);
+ GNUNET_free (pos);
}
prev = pos;
pos = pos->next;
}
GNUNET_mutex_unlock (lock);
- GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK |
GNUNET_GE_USER,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
_
("%s::%s - async RPC %s:%p could not be unregistered: not
found\n"),
__FILE__, __FUNCTION__, name, callback);
@@ -410,8 +408,8 @@
unsigned int slen;
slen = ntohl (req->functionNameLength);
- if ( (ntohs (req->header.size) < sizeof (P2P_rpc_MESSAGE) + slen) ||
- (sizeof(P2P_rpc_MESSAGE) + slen < sizeof(P2P_rpc_MESSAGE) ) )
+ if ((ntohs (req->header.size) < sizeof (P2P_rpc_MESSAGE) + slen) ||
+ (sizeof (P2P_rpc_MESSAGE) + slen < sizeof (P2P_rpc_MESSAGE)))
return NULL; /* invalid! */
ret = GNUNET_malloc (slen + 1);
memcpy (ret, &req[1], slen);
@@ -433,8 +431,8 @@
slen = ntohl (req->functionNameLength);
else
slen = 0;
- if ( (ntohs (req->header.size) < sizeof (P2P_rpc_MESSAGE) + slen) ||
- (sizeof(P2P_rpc_MESSAGE) + slen < sizeof(P2P_rpc_MESSAGE) ) )
+ if ((ntohs (req->header.size) < sizeof (P2P_rpc_MESSAGE) + slen) ||
+ (sizeof (P2P_rpc_MESSAGE) + slen < sizeof (P2P_rpc_MESSAGE)))
return NULL; /* invalid! */
ret =
GNUNET_RPC_parameters_deserialize (&((char *) &req[1])[slen],
@@ -453,8 +451,8 @@
*/
static void
RPC_send_ack (const GNUNET_PeerIdentity * receiver,
- unsigned int sequenceNumber,
- unsigned int importance, unsigned int maxDelay)
+ unsigned int sequenceNumber,
+ unsigned int importance, unsigned int maxDelay)
{
RPC_ACK_Message msg;
@@ -477,19 +475,19 @@
*/
static P2P_rpc_MESSAGE *
RPC_build_message (unsigned short errorCode,
- const char *name,
- unsigned int sequenceNumber,
- unsigned int importance,
- const struct GNUNET_RPC_CallParameters * values)
+ const char *name,
+ unsigned int sequenceNumber,
+ unsigned int importance,
+ const struct GNUNET_RPC_CallParameters *values)
{
P2P_rpc_MESSAGE *ret;
size_t size = sizeof (P2P_rpc_MESSAGE);
int slen;
if (name != NULL)
- slen = strlen (name);
+ slen = strlen (name);
else
- slen = 0;
+ slen = 0;
size += slen;
if (values != NULL)
size += GNUNET_RPC_parameters_get_serialized_size (values);
@@ -497,7 +495,9 @@
return NULL; /* message to big! */
ret = GNUNET_malloc (size);
ret->header.size = htons (size);
- ret->header.type = htons ((name == NULL) ? GNUNET_P2P_PROTO_RPC_RES :
GNUNET_P2P_PROTO_RPC_REQ);
+ ret->header.type =
+ htons ((name ==
+ NULL) ? GNUNET_P2P_PROTO_RPC_RES : GNUNET_P2P_PROTO_RPC_REQ);
ret->timestamp = htonl (GNUNET_get_time_int32 (NULL));
ret->sequenceNumber = htonl (sequenceNumber);
ret->importance = htonl (importance);
@@ -507,7 +507,7 @@
ret->functionNameLength = htonl (slen);
ret->argumentCount = htonl (GNUNET_RPC_parameters_count (values));
if (name != NULL)
- memcpy (&ret[1], name, slen);
+ memcpy (&ret[1], name, slen);
GNUNET_RPC_parameters_serialize (values, &((char *) &ret[1])[slen]);
return ret;
}
@@ -521,29 +521,27 @@
* an RPC to the peer that initiated it.
*/
static void
-RPC_complete (const struct GNUNET_RPC_CallParameters * results,
- int errorCode,
- struct GNUNET_RPC_CallHandle * call)
+RPC_complete (const struct GNUNET_RPC_CallParameters *results,
+ int errorCode, struct GNUNET_RPC_CallHandle *call)
{
GNUNET_mutex_lock (lock);
- GNUNET_GE_ASSERT(NULL, call->msg == NULL);
+ GNUNET_GE_ASSERT (NULL, call->msg == NULL);
call->msg = RPC_build_message (errorCode,
- NULL,
- call->sequenceNumber,
- call->importance, results);
+ NULL,
+ call->sequenceNumber,
+ call->importance, results);
if (call->msg == NULL)
call->msg = RPC_build_message (GNUNET_RPC_ERROR_RETURN_VALUE_TOO_LARGE,
- NULL,
- call->sequenceNumber,
- call->importance, results);
- call->lastAttempt = GNUNET_get_time();
+ NULL,
+ call->sequenceNumber,
+ call->importance, results);
+ call->lastAttempt = GNUNET_get_time ();
call->repetitionFrequency = RPC_INITIAL_ROUND_TRIP_TIME;
call->attempts = 1;
call->errorCode = errorCode;
- coreAPI->unicast(&call->initiator,
- &call->msg->header,
- call->importance,
- RPC_INITIAL_ROUND_TRIP_TIME / 2);
+ coreAPI->unicast (&call->initiator,
+ &call->msg->header,
+ call->importance, RPC_INITIAL_ROUND_TRIP_TIME / 2);
GNUNET_mutex_unlock (lock);
}
@@ -556,8 +554,8 @@
handleRPCMessageReq (const GNUNET_PeerIdentity * sender,
const GNUNET_MessageHeader * message)
{
- const P2P_rpc_MESSAGE * req;
- struct GNUNET_RPC_CallHandle * pos;
+ const P2P_rpc_MESSAGE *req;
+ struct GNUNET_RPC_CallHandle *pos;
struct GNUNET_RPC_CallParameters *argumentValues;
const struct RegisteredRPC *rpc;
unsigned int sq;
@@ -566,21 +564,21 @@
if (ntohs (message->size) < sizeof (P2P_rpc_MESSAGE))
{
- GNUNET_GE_BREAK_OP(NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR;
}
req = (const P2P_rpc_MESSAGE *) message;
functionName = RPC_get_function_name (req);
if (functionName == NULL)
{
- GNUNET_GE_BREAK_OP(NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR;
}
argumentValues = RPC_deserialize_arguments (req);
if (argumentValues == NULL)
{
GNUNET_free (functionName);
- GNUNET_GE_BREAK_OP(NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR; /* message malformed */
}
sq = ntohl (req->sequenceNumber);
@@ -589,24 +587,20 @@
GNUNET_mutex_lock (lock);
pos = incomingCalls;
total = 0;
- while ( (pos != NULL) &&
- ( (pos->sequenceNumber != sq) ||
- (0 != memcmp(&pos->initiator,
- sender,
- sizeof(GNUNET_PeerIdentity)))) )
+ while ((pos != NULL) &&
+ ((pos->sequenceNumber != sq) ||
+ (0 != memcmp (&pos->initiator,
+ sender, sizeof (GNUNET_PeerIdentity)))))
{
- if (0 == memcmp(&pos->initiator,
- sender,
- sizeof(GNUNET_PeerIdentity)))
- total++;
+ if (0 == memcmp (&pos->initiator, sender, sizeof (GNUNET_PeerIdentity)))
+ total++;
pos = pos->next;
}
- if ( (pos != NULL) ||
- (total > RPC_MAX_REQUESTS_PER_PEER) )
+ if ((pos != NULL) || (total > RPC_MAX_REQUESTS_PER_PEER))
{
/* already pending or too many pending */
GNUNET_free (functionName);
- GNUNET_RPC_parameters_destroy(argumentValues);
+ GNUNET_RPC_parameters_destroy (argumentValues);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -621,7 +615,7 @@
}
/* create call handle */
pos = GNUNET_malloc (sizeof (struct GNUNET_RPC_CallHandle));
- memset(pos, 0, sizeof (struct GNUNET_RPC_CallHandle));
+ memset (pos, 0, sizeof (struct GNUNET_RPC_CallHandle));
pos->function_name = functionName;
pos->sequenceNumber = sq;
pos->initiator = *sender;
@@ -632,14 +626,9 @@
incomingCalls->prev = pos;
incomingCalls = pos;
if (rpc == NULL)
- RPC_complete(NULL,
- GNUNET_RPC_ERROR_UNKNOWN_FUNCTION,
- pos);
+ RPC_complete (NULL, GNUNET_RPC_ERROR_UNKNOWN_FUNCTION, pos);
else
- rpc->async_callback (rpc->cls,
- sender,
- argumentValues,
- pos);
+ rpc->async_callback (rpc->cls, sender, argumentValues, pos);
GNUNET_RPC_parameters_destroy (argumentValues);
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
@@ -655,20 +644,18 @@
const GNUNET_MessageHeader * message)
{
const P2P_rpc_MESSAGE *res;
- struct GNUNET_RPC_RequestHandle * pos;
+ struct GNUNET_RPC_RequestHandle *pos;
struct GNUNET_RPC_CallParameters *reply;
unsigned int error;
if (ntohs (message->size) < sizeof (P2P_rpc_MESSAGE))
{
- GNUNET_GE_BREAK_OP(NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR;
}
res = (const P2P_rpc_MESSAGE *) message;
- RPC_send_ack(sender,
- ntohl(res->sequenceNumber),
- ntohl(res->importance),
- 0);
+ RPC_send_ack (sender,
+ ntohl (res->sequenceNumber), ntohl (res->importance), 0);
/* Locate the GNUNET_RPC_CallHandle structure. */
GNUNET_mutex_lock (lock);
pos = outgoingCalls;
@@ -695,11 +682,9 @@
error = ntohl (res->functionNameLength);
if (error == GNUNET_RPC_ERROR_OK)
reply = GNUNET_RPC_parameters_deserialize ((char *) &res[1],
- ntohs (message->size) -
- sizeof
- (P2P_rpc_MESSAGE));
- if (ntohl (res->argumentCount) !=
- GNUNET_RPC_parameters_count (reply))
+ ntohs (message->size) -
+ sizeof (P2P_rpc_MESSAGE));
+ if (ntohl (res->argumentCount) != GNUNET_RPC_parameters_count (reply))
{
GNUNET_RPC_parameters_destroy (reply);
reply = NULL;
@@ -707,15 +692,12 @@
}
if (pos->callback != NULL)
{
- pos->callback(sender,
- reply,
- error,
- pos->cls);
+ pos->callback (sender, reply, error, pos->cls);
pos->callback = NULL;
pos->errorCode = error;
}
if (reply != NULL)
- GNUNET_RPC_parameters_destroy (reply);
+ GNUNET_RPC_parameters_destroy (reply);
return GNUNET_OK;
}
@@ -731,7 +713,7 @@
if (ntohs (message->size) != sizeof (RPC_ACK_Message))
{
- GNUNET_GE_BREAK_OP(NULL, 0);
+ GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR;
}
ack = (const RPC_ACK_Message *) message;
@@ -781,7 +763,7 @@
static struct GNUNET_RPC_RequestHandle *
RPC_start (const GNUNET_PeerIdentity * receiver,
const char *name,
- const struct GNUNET_RPC_CallParameters * request_param,
+ const struct GNUNET_RPC_CallParameters *request_param,
unsigned int importance,
GNUNET_CronTime timeout,
GNUNET_RPC_AsynchronousCompletionCallback callback, void *closure)
@@ -789,9 +771,9 @@
struct GNUNET_RPC_RequestHandle *ret;
if (timeout > 1 * GNUNET_CRON_HOURS)
- timeout = 1 * GNUNET_CRON_HOURS;
+ timeout = 1 * GNUNET_CRON_HOURS;
ret = GNUNET_malloc (sizeof (struct GNUNET_RPC_RequestHandle));
- memset(ret, 0, sizeof (struct GNUNET_RPC_RequestHandle));
+ memset (ret, 0, sizeof (struct GNUNET_RPC_RequestHandle));
ret->receiver = *receiver;
ret->callback = callback;
ret->cls = closure;
@@ -800,9 +782,9 @@
ret->attempts = 0;
ret->sequenceNumber = rpcIdentifier++;
ret->msg = RPC_build_message (GNUNET_RPC_ERROR_OK,
- name,
- ret->sequenceNumber,
- importance, request_param);
+ name,
+ ret->sequenceNumber,
+ importance, request_param);
ret->repetitionFrequency = RPC_INITIAL_ROUND_TRIP_TIME;
GNUNET_mutex_lock (lock);
ret->next = outgoingCalls;
@@ -810,10 +792,9 @@
if (ret->next != NULL)
ret->next->prev = ret;
GNUNET_mutex_unlock (lock);
- coreAPI->unicast(receiver,
- &ret->msg->header,
- importance,
- RPC_INITIAL_ROUND_TRIP_TIME / 2);
+ coreAPI->unicast (receiver,
+ &ret->msg->header,
+ importance, RPC_INITIAL_ROUND_TRIP_TIME / 2);
return ret;
}
@@ -825,7 +806,7 @@
* another RPC_ERROR code if it was aborted
*/
static int
-RPC_stop (struct GNUNET_RPC_RequestHandle * record)
+RPC_stop (struct GNUNET_RPC_RequestHandle *record)
{
int ret;
@@ -838,7 +819,8 @@
record->next->prev = record->prev;
GNUNET_free (record->msg);
GNUNET_mutex_unlock (lock);
- ret = (record->callback == NULL) ? record->errorCode :
GNUNET_RPC_ERROR_ABORTED;
+ ret =
+ (record->callback == NULL) ? record->errorCode : GNUNET_RPC_ERROR_ABORTED;
GNUNET_free (record);
return ret;
}
@@ -850,79 +832,75 @@
* there to trigger timeouts.
*/
static void
-RPC_retry_job (void * unused)
+RPC_retry_job (void *unused)
{
GNUNET_CronTime now;
- struct GNUNET_RPC_CallHandle * ipos;
- struct GNUNET_RPC_RequestHandle * opos;
+ struct GNUNET_RPC_CallHandle *ipos;
+ struct GNUNET_RPC_RequestHandle *opos;
GNUNET_mutex_lock (lock);
now = GNUNET_get_time ();
ipos = incomingCalls;
while (ipos != NULL)
{
- if ( (ipos->expirationTime < now) ||
- (ipos->attempts >= RPC_MAX_REPLY_ATTEMPTS) )
- {
- GNUNET_free_non_null(ipos->msg);
- GNUNET_free(ipos->function_name);
- if (ipos->prev == NULL)
- incomingCalls = ipos->next;
- else
- ipos->prev->next = ipos->next;
- if (ipos->next != NULL)
- ipos->next = ipos->prev;
- GNUNET_free(ipos);
- ipos = incomingCalls;
- continue;
- }
- if ( (ipos->msg != NULL) &&
- (ipos->lastAttempt + ipos->repetitionFrequency < now) )
- {
- ipos->lastAttempt = now;
- ipos->attempts++;
- ipos->repetitionFrequency *= 2;
- coreAPI->unicast(&ipos->initiator,
- &ipos->msg->header,
- ipos->repetitionFrequency / 2,
- ipos->importance);
- }
+ if ((ipos->expirationTime < now) ||
+ (ipos->attempts >= RPC_MAX_REPLY_ATTEMPTS))
+ {
+ GNUNET_free_non_null (ipos->msg);
+ GNUNET_free (ipos->function_name);
+ if (ipos->prev == NULL)
+ incomingCalls = ipos->next;
+ else
+ ipos->prev->next = ipos->next;
+ if (ipos->next != NULL)
+ ipos->next = ipos->prev;
+ GNUNET_free (ipos);
+ ipos = incomingCalls;
+ continue;
+ }
+ if ((ipos->msg != NULL) &&
+ (ipos->lastAttempt + ipos->repetitionFrequency < now))
+ {
+ ipos->lastAttempt = now;
+ ipos->attempts++;
+ ipos->repetitionFrequency *= 2;
+ coreAPI->unicast (&ipos->initiator,
+ &ipos->msg->header,
+ ipos->repetitionFrequency / 2, ipos->importance);
+ }
ipos = ipos->next;
}
opos = outgoingCalls;
while (opos != NULL)
{
if (opos->expirationTime < now)
- {
- if (opos->callback != NULL)
- {
- opos->callback(&opos->receiver,
- NULL,
- GNUNET_RPC_ERROR_TIMEOUT,
- opos->cls);
- opos->callback = NULL;
- }
- GNUNET_free_non_null(opos->msg);
- if (opos->prev == NULL)
- outgoingCalls = opos->next;
- else
- opos->prev->next = opos->next;
- if (opos->next != NULL)
- opos->next = opos->prev;
- GNUNET_free(opos);
- opos = outgoingCalls;
- continue;
- }
- if (opos->lastAttempt + opos->repetitionFrequency < now)
- {
- opos->lastAttempt = now;
- opos->attempts++;
- opos->repetitionFrequency *= 2;
- coreAPI->unicast(&opos->receiver,
- &opos->msg->header,
- opos->repetitionFrequency / 2,
- opos->importance);
- }
+ {
+ if (opos->callback != NULL)
+ {
+ opos->callback (&opos->receiver,
+ NULL, GNUNET_RPC_ERROR_TIMEOUT, opos->cls);
+ opos->callback = NULL;
+ }
+ GNUNET_free_non_null (opos->msg);
+ if (opos->prev == NULL)
+ outgoingCalls = opos->next;
+ else
+ opos->prev->next = opos->next;
+ if (opos->next != NULL)
+ opos->next = opos->prev;
+ GNUNET_free (opos);
+ opos = outgoingCalls;
+ continue;
+ }
+ if (opos->lastAttempt + opos->repetitionFrequency < now)
+ {
+ opos->lastAttempt = now;
+ opos->attempts++;
+ opos->repetitionFrequency *= 2;
+ coreAPI->unicast (&opos->receiver,
+ &opos->msg->header,
+ opos->repetitionFrequency / 2, opos->importance);
+ }
opos = opos->next;
}
GNUNET_mutex_unlock (lock);
@@ -939,13 +917,11 @@
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_REQ, &handleRPCMessageReq);
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_RES, &handleRPCMessageRes);
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_ACK, &handleRPCMessageAck);
- GNUNET_GE_ASSERT(NULL, NULL == incomingCalls);
- GNUNET_GE_ASSERT(NULL, NULL == outgoingCalls);
- GNUNET_GE_ASSERT(NULL, NULL == list_of_callbacks);
- GNUNET_cron_del_job(coreAPI->cron,
- &RPC_retry_job,
- RPC_CRON_FREQUENCY,
- NULL);
+ GNUNET_GE_ASSERT (NULL, NULL == incomingCalls);
+ GNUNET_GE_ASSERT (NULL, NULL == outgoingCalls);
+ GNUNET_GE_ASSERT (NULL, NULL == list_of_callbacks);
+ GNUNET_cron_del_job (coreAPI->cron,
+ &RPC_retry_job, RPC_CRON_FREQUENCY, NULL);
coreAPI = NULL;
lock = NULL;
}
@@ -961,9 +937,10 @@
lock = capi->connection_get_lock ();
coreAPI = capi;
- GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_USER,
- _("`%s' registering handlers %d %d %d\n"),
- "rpc", GNUNET_P2P_PROTO_RPC_REQ, GNUNET_P2P_PROTO_RPC_RES,
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
+ _("`%s' registering handlers %d %d %d\n"), "rpc",
+ GNUNET_P2P_PROTO_RPC_REQ, GNUNET_P2P_PROTO_RPC_RES,
GNUNET_P2P_PROTO_RPC_ACK);
rvalue = GNUNET_OK;
if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_REQ,
@@ -983,17 +960,15 @@
_("Failed to initialize `%s' service.\n"), "rpc");
return NULL;
}
- GNUNET_cron_add_job(coreAPI->cron,
- &RPC_retry_job,
- RPC_CRON_FREQUENCY,
- RPC_CRON_FREQUENCY,
- NULL);
+ GNUNET_cron_add_job (coreAPI->cron,
+ &RPC_retry_job,
+ RPC_CRON_FREQUENCY, RPC_CRON_FREQUENCY, NULL);
rpcAPI.RPC_register = &RPC_register;
rpcAPI.RPC_unregister = &RPC_unregister;
rpcAPI.RPC_complete = &RPC_complete;
rpcAPI.RPC_start = &RPC_start;
rpcAPI.RPC_stop = &RPC_stop;
- return &rpcAPI;
+ return &rpcAPI;
}
/* end of rpc.c */
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2008-02-18 03:47:19 UTC
(rev 6359)
+++ GNUnet/src/applications/topology_default/topology.c 2008-02-18 04:43:41 UTC
(rev 6360)
@@ -606,7 +606,7 @@
}
GNUNET_free (data);
}
- GNUNET_free_non_null(fn);
+ GNUNET_free_non_null (fn);
return 0;
}
Modified: GNUnet/src/include/gnunet_dht_lib.h
===================================================================
--- GNUnet/src/include/gnunet_dht_lib.h 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/src/include/gnunet_dht_lib.h 2008-02-18 04:43:41 UTC (rev 6360)
@@ -67,9 +67,7 @@
int GNUNET_DHT_put (struct GNUNET_GC_Configuration *cfg,
struct GNUNET_GE_Context *ectx,
const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size,
- const char * value);
+ unsigned int type, unsigned int size, const char *value);
#if 0 /* keep Emacsens' auto-indent happy */
{
Modified: GNUnet/src/include/gnunet_dstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_dstore_service.h 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/include/gnunet_dstore_service.h 2008-02-18 04:43:41 UTC (rev
6360)
@@ -43,9 +43,9 @@
#endif
typedef int (*GNUNET_ResultProcessor) (const GNUNET_HashCode * key,
- unsigned int type,
- unsigned int size,
- const char *data, void *cls);
+ unsigned int type,
+ unsigned int size,
+ const char *data, void *cls);
/**
* @brief Definition of the SQ-Store API.
Modified: GNUnet/src/include/gnunet_rpc_lib.h
===================================================================
--- GNUnet/src/include/gnunet_rpc_lib.h 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/src/include/gnunet_rpc_lib.h 2008-02-18 04:43:41 UTC (rev 6360)
@@ -48,48 +48,56 @@
*/
struct GNUNET_RPC_CallParameters *GNUNET_RPC_parameters_create (void);
-void GNUNET_RPC_parameters_destroy (struct GNUNET_RPC_CallParameters * param);
+void GNUNET_RPC_parameters_destroy (struct GNUNET_RPC_CallParameters *param);
-unsigned int GNUNET_RPC_parameters_count (const struct
GNUNET_RPC_CallParameters * param);
+unsigned int GNUNET_RPC_parameters_count (const struct
+ GNUNET_RPC_CallParameters *param);
-void GNUNET_RPC_parameters_add (struct GNUNET_RPC_CallParameters * param,
+void GNUNET_RPC_parameters_add (struct GNUNET_RPC_CallParameters *param,
const char *name,
unsigned int dataLength, const void *data);
/**
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_RPC_parameters_get_value_by_name (const struct
GNUNET_RPC_CallParameters *
- param, const char *name,
+int GNUNET_RPC_parameters_get_value_by_name (const struct
+ GNUNET_RPC_CallParameters *param,
+ const char *name,
unsigned int *dataLength,
- void const ** data);
+ void const **data);
/**
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_RPC_parameters_get_value_by_index (const struct
GNUNET_RPC_CallParameters *
- param, unsigned int i,
+int GNUNET_RPC_parameters_get_value_by_index (const struct
+ GNUNET_RPC_CallParameters
+ *param, unsigned int i,
unsigned int *dataLength,
- void const ** data);
+ void const **data);
/**
* Serialize the param array.
*
* @param target must point to at least
GNUNET_RPC_parameters_get_serialized_size(param) bytes of memory.
*/
-void GNUNET_RPC_parameters_serialize (const struct GNUNET_RPC_CallParameters *
param,
- char *target);
+void GNUNET_RPC_parameters_serialize (const struct GNUNET_RPC_CallParameters
+ *param, char *target);
/**
* Deserialize parameters from buffer.
*/
-struct GNUNET_RPC_CallParameters *GNUNET_RPC_parameters_deserialize (const
char *buffer,
- size_t
size);
+struct GNUNET_RPC_CallParameters *GNUNET_RPC_parameters_deserialize (const
+ char
+ *buffer,
+ size_t
+ size);
/**
* How many bytes are required to serialize the param array?
*/
-size_t GNUNET_RPC_parameters_get_serialized_size (const struct
GNUNET_RPC_CallParameters * param);
+size_t GNUNET_RPC_parameters_get_serialized_size (const struct
+ GNUNET_RPC_CallParameters
+ *param);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: GNUnet/src/include/gnunet_rpc_service.h
===================================================================
--- GNUnet/src/include/gnunet_rpc_service.h 2008-02-18 03:47:19 UTC (rev
6359)
+++ GNUnet/src/include/gnunet_rpc_service.h 2008-02-18 04:43:41 UTC (rev
6360)
@@ -87,10 +87,11 @@
* @param arguments arguments to the call
* @param context argument to pass to rpc->RPC_complete when the function is
done
*/
-typedef void (*GNUNET_RPC_AsynchronousFunction) (void * cls,
- const GNUNET_PeerIdentity *
+typedef void (*GNUNET_RPC_AsynchronousFunction) (void *cls,
+ const GNUNET_PeerIdentity *
caller,
- const struct
GNUNET_RPC_CallParameters *
+ const struct
+ GNUNET_RPC_CallParameters *
arguments,
struct GNUNET_RPC_CallHandle
* context);
@@ -104,11 +105,14 @@
* @param results return values
* @param closure client-specific context
*/
-typedef void (*GNUNET_RPC_AsynchronousCompletionCallback) (const
GNUNET_PeerIdentity
+typedef void (*GNUNET_RPC_AsynchronousCompletionCallback) (const
+ GNUNET_PeerIdentity
* responder,
- const struct
GNUNET_RPC_CallParameters
+ const struct
+
GNUNET_RPC_CallParameters
* results,
- unsigned int
errorCode,
+ unsigned int
+ errorCode,
void *closure);
struct GNUNET_RPC_RequestHandle;
@@ -123,16 +127,14 @@
* Register an asynchronous RPC function.
*/
int (*RPC_register) (const char *name,
- GNUNET_RPC_AsynchronousFunction func,
- void * cls);
+ GNUNET_RPC_AsynchronousFunction func, void *cls);
/**
* Unregister an asynchronous RPC function.
*/
int (*RPC_unregister) (const char *name,
- GNUNET_RPC_AsynchronousFunction func,
- void * cls);
+ GNUNET_RPC_AsynchronousFunction func, void *cls);
/**
* Start an asynchronous RPC.
@@ -146,7 +148,8 @@
*/
struct GNUNET_RPC_RequestHandle *(*RPC_start) (const GNUNET_PeerIdentity *
receiver, const char *name,
- const struct
GNUNET_RPC_CallParameters *
+ const struct
+ GNUNET_RPC_CallParameters *
request_param,
unsigned int importance,
GNUNET_CronTime timeout,
@@ -173,9 +176,8 @@
* that is called from the RPC module.
*/
void (*RPC_complete) (const struct GNUNET_RPC_CallParameters *
- results, int errorCode,
- struct GNUNET_RPC_CallHandle *
- context);
+ results, int errorCode,
+ struct GNUNET_RPC_CallHandle * context);
} GNUNET_RPC_ServiceAPI;
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/src/server/connection.c 2008-02-18 04:43:41 UTC (rev 6360)
@@ -2940,7 +2940,7 @@
if ((root->available_send_window > 35 * 1024) &&
(root->sendBufferSize < 4) &&
(scl_head != NULL) &&
- (root->status == STAT_UP) &&
+ (root->status == STAT_UP) &&
(load_nup < GNUNET_IDLE_LOAD_THRESHOLD) &&
(load_cpu < GNUNET_IDLE_LOAD_THRESHOLD))
{
@@ -3767,24 +3767,19 @@
create (gettext_noop ("# average connection lifetime (in ms)"));
stat_shutdown_excessive_bandwidth =
stats->
- create (gettext_noop
- ("# connections shutdown because other peer sent too much"));
+ create (gettext_noop ("# conn. shutdown: other peer sent too much"));
stat_shutdown_insufficient_bandwidth =
stats->
- create (gettext_noop
- ("# connections shutdown because we lacked bandwidth"));
+ create (gettext_noop ("# conn. shutdown: we lacked bandwidth"));
stat_shutdown_timeout =
stats->
- create (gettext_noop
- ("# connections shutdown because other peer timed out"));
+ create (gettext_noop ("# conn. shutdown: other peer timed out"));
stat_shutdown_connect_timeout =
stats->
- create (gettext_noop
- ("# connections shutdown because other peer timed out during
connect"));
+ create (gettext_noop ("# conn. shutdown: timed out during connect"));
stat_shutdown_hangup_received =
stats->
- create (gettext_noop
- ("# connections shutdown because other peer requested it"));
+ create (gettext_noop ("# conn. shutdown: other peer requested it"));
}
transport->start (&GNUNET_CORE_p2p_receive);
EXIT ();
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-02-18 03:47:19 UTC (rev 6359)
+++ GNUnet/todo 2008-02-18 04:43:41 UTC (rev 6360)
@@ -5,10 +5,6 @@
0.7.4 [4'08] (aka "fix search"):
- tune GAP query planning code [RC]
-- gnunet-auto-share check for timestamp works for
- copying, but does not work for files MOVED to the
- share directory (since the mtime will be in the past!);
- should ALSO use test_indexed!
TESTING:
- test new hostlist application
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6360 - in GNUnet: . contrib doc/man src/applications/dht/module src/applications/dht/tools src/applications/fs/fsui src/applications/fs/gap src/applications/fs/tools src/applications/rpc src/applications/topology_default src/include src/server,
gnunet <=