[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6325 - in GNUnet: contrib src/applications/chat src/applic
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6325 - in GNUnet: contrib src/applications/chat src/applications/dht/module src/applications/fs/gap src/applications/fs/tools src/applications/session src/applications/topology_default |
Date: |
Sat, 16 Feb 2008 14:03:06 -0700 (MST) |
Author: grothoff
Date: 2008-02-16 14:03:06 -0700 (Sat, 16 Feb 2008)
New Revision: 6325
Modified:
GNUnet/contrib/config-daemon.scm
GNUnet/src/applications/chat/clientapi.c
GNUnet/src/applications/dht/module/table.c
GNUnet/src/applications/fs/gap/fs.c
GNUnet/src/applications/fs/gap/gap.c
GNUnet/src/applications/fs/gap/migration.c
GNUnet/src/applications/fs/gap/migration.h
GNUnet/src/applications/fs/gap/test_multi_results.c
GNUnet/src/applications/fs/tools/gnunet-auto-share.c
GNUnet/src/applications/session/connect.c
GNUnet/src/applications/topology_default/topology.c
Log:
new option for migration, change of migration to use PID table and
received-message injection into migration
Modified: GNUnet/contrib/config-daemon.scm
===================================================================
--- GNUnet/contrib/config-daemon.scm 2008-02-16 20:21:12 UTC (rev 6324)
+++ GNUnet/contrib/config-daemon.scm 2008-02-16 21:03:06 UTC (rev 6325)
@@ -768,6 +768,19 @@
'always))
+(define (fs-migration-buffer builder)
+ (builder
+ "FS"
+ "MIGRATIONBUFFERSIZE"
+ (_ "Number of entries in the migration buffer")
+ (_ "Each entry uses about 32k of memory. More entries can reduce disk IO
and CPU usage at the expense of having gnunetd use more memory. Very large
values may again increase CPU usage. A value of 0 will prevent your peer from
sending unsolicited responses.")
+ '()
+ #t
+ 64
+ (cons 0 1048576)
+ 'always))
+
+
(define (fs-gap-tablesize builder)
(builder
"GAP"
Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c 2008-02-16 20:21:12 UTC (rev
6324)
+++ GNUnet/src/applications/chat/clientapi.c 2008-02-16 21:03:06 UTC (rev
6325)
@@ -196,7 +196,7 @@
{
// stop thread
// join thread
- // free room struct
+ // free room struct
GNUNET_free (chat_room->nickname);
GNUNET_free (chat_room->memberInfo);
Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c 2008-02-16 20:21:12 UTC (rev
6324)
+++ GNUnet/src/applications/dht/module/table.c 2008-02-16 21:03:06 UTC (rev
6325)
@@ -728,22 +728,21 @@
}
static void
-peer_disconnect_handler(const GNUNET_PeerIdentity * peer,
- void * unused)
+peer_disconnect_handler (const GNUNET_PeerIdentity * peer, void *unused)
{
- PeerBucket * bucket;
- PeerInfo * info;
+ PeerBucket *bucket;
+ PeerInfo *info;
GNUNET_mutex_lock (lock);
- bucket = findBucketFor(peer);
+ bucket = findBucketFor (peer);
if (bucket != NULL)
{
- info = findPeerEntryInBucket(bucket, peer);
+ info = findPeerEntryInBucket (bucket, peer);
if (info != NULL)
- {
- info->lastActivity = 0;
- checkExpiration(bucket);
- }
+ {
+ info->lastActivity = 0;
+ checkExpiration (bucket);
+ }
}
GNUNET_mutex_unlock (lock);
}
@@ -790,8 +789,7 @@
GNUNET_GE_ASSERT (coreAPI->ectx, pingpong != NULL);
capi->registerHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY, &handleDiscovery);
capi->registerHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
- capi->register_notify_peer_disconnect(&peer_disconnect_handler,
- NULL);
+ capi->register_notify_peer_disconnect (&peer_disconnect_handler, NULL);
GNUNET_cron_add_job (coreAPI->cron,
&maintain_dht_job,
MAINTAIN_FREQUENCY, MAINTAIN_FREQUENCY, NULL);
@@ -809,8 +807,7 @@
unsigned int i;
unsigned int j;
- coreAPI->unregister_notify_peer_disconnect(&peer_disconnect_handler,
- NULL);
+ coreAPI->unregister_notify_peer_disconnect (&peer_disconnect_handler, NULL);
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY,
&handleDiscovery);
coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO,
Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-02-16 20:21:12 UTC (rev 6324)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-02-16 21:03:06 UTC (rev 6325)
@@ -671,8 +671,7 @@
GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* invalid! */
}
- if ( (stats != NULL) &&
- (sender != NULL) )
+ if ((stats != NULL) && (sender != NULL))
stats->change (stat_gap_content_received, 1);
expiration = GNUNET_ntohll (msg->expiration);
/* forward to other peers */
@@ -737,11 +736,10 @@
&hardCPULimit)) || (-1
== GNUNET_GC_get_configuration_value_number (coreAPI->cfg, "LOAD",
"HARDUPLIMIT", 0, 999999999, 0, /* 0 == no limit */
&hardUpLimit)))
return GNUNET_SYSERR;
- active_migration
- = GNUNET_GC_get_configuration_value_yesno(coreAPI->cfg,
- "FS",
- "ACTIVEMIGRATION",
- GNUNET_NO);
+ active_migration
+ = GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
+ "FS",
+ "ACTIVEMIGRATION", GNUNET_NO);
stats = capi->request_service ("stats");
if (stats != NULL)
{
Modified: GNUnet/src/applications/fs/gap/gap.c
===================================================================
--- GNUnet/src/applications/fs/gap/gap.c 2008-02-16 20:21:12 UTC (rev
6324)
+++ GNUnet/src/applications/fs/gap/gap.c 2008-02-16 21:03:06 UTC (rev
6325)
@@ -34,6 +34,7 @@
#include "ondemand.h"
#include "plan.h"
#include "pid_table.h"
+#include "migration.h"
/**
* How many entries are allowed per slot in the
@@ -401,6 +402,8 @@
P2P_gap_reply_MESSAGE *msg;
PID_INDEX rid;
unsigned int index;
+ PID_INDEX blocked[MAX_ENTRIES_PER_SLOT + 1];
+ unsigned int block_count;
value = 0;
GNUNET_mutex_lock (GNUNET_FS_lock);
@@ -408,6 +411,15 @@
index = get_table_index (primary_query);
rl = table[index];
prev = NULL;
+ if (rid != 0)
+ {
+ blocked[0] = rid;
+ block_count = 1;
+ }
+ else
+ {
+ block_count = 0;
+ }
while (rl != NULL)
{
if (GNUNET_OK == GNUNET_FS_SHARED_test_valid_new_response (rl,
@@ -417,6 +429,8 @@
{
GNUNET_GE_ASSERT (NULL, rl->response_target != 0);
GNUNET_FS_PT_resolve (rl->response_target, &target);
+ GNUNET_GE_ASSERT (NULL, block_count <= MAX_ENTRIES_PER_SLOT);
+ blocked[block_count++] = rl->response_target;
/* queue response */
msg = GNUNET_malloc (sizeof (P2P_gap_reply_MESSAGE) + size);
msg->header.type = htons (GNUNET_P2P_PROTO_GAP_RESULT);
@@ -451,6 +465,8 @@
prev = rl;
rl = rl->next;
}
+ GNUNET_FS_MIGRATION_inject (primary_query,
+ size, data, expiration, block_count, blocked);
GNUNET_mutex_unlock (GNUNET_FS_lock);
GNUNET_FS_PT_change_rc (rid, -1);
return value;
Modified: GNUnet/src/applications/fs/gap/migration.c
===================================================================
--- GNUnet/src/applications/fs/gap/migration.c 2008-02-16 20:21:12 UTC (rev
6324)
+++ GNUnet/src/applications/fs/gap/migration.c 2008-02-16 21:03:06 UTC (rev
6325)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005, 2007 Christian Grothoff (and other
contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008 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
@@ -28,8 +28,8 @@
#include "platform.h"
#include "migration.h"
#include "fs.h"
+#include "pid_table.h"
#include "shared.h"
-#include "gnunet_datastore_service.h"
#include "gnunet_stats_service.h"
#include "gnunet_protocols.h"
#include "anonymity.h"
@@ -51,15 +51,6 @@
#define MAX_RECEIVERS 16
/**
- * How many migration records do we keep in memory
- * at the same time? Each record is about 32k, so
- * 64 records will use about 2 MB of memory.
- * We might want to allow users to specify larger
- * values in the configuration file some day.
- */
-#define MAX_RECORDS 64
-
-/**
* How often do we poll the datastore for content (at most).
*/
#define MAX_POLL_FREQUENCY (250 * GNUNET_CRON_MILLISECONDS)
@@ -91,12 +82,14 @@
{
GNUNET_DatastoreValue *value;
GNUNET_HashCode key;
- unsigned int receiverIndices[MAX_RECEIVERS];
+ PID_INDEX receiverIndices[MAX_RECEIVERS];
unsigned int sentCount;
};
-static struct MigrationRecord content[MAX_RECORDS];
+static unsigned int content_size;
+static struct MigrationRecord *content;
+
/**
* Callback method for pushing content into the network.
* The method chooses either a "recently" deleted block
@@ -125,7 +118,7 @@
GNUNET_DatastoreValue *enc;
GNUNET_DatastoreValue *value;
P2P_gap_reply_MESSAGE *msg;
- unsigned int index;
+ PID_INDEX index;
int entry;
int discard_entry;
int discard_match;
@@ -135,14 +128,16 @@
unsigned int dist;
unsigned int minDist;
- index = coreAPI->connection_compute_index_of_peer (receiver);
+ if (content_size == 0)
+ return 0;
+ index = GNUNET_FS_PT_intern (receiver);
GNUNET_mutex_lock (GNUNET_FS_lock);
now = GNUNET_get_time ();
entry = -1;
discard_entry = -1;
discard_match = -1;
minDist = -1; /* max */
- for (i = 0; i < MAX_RECORDS; i++)
+ for (i = 0; i < content_size; i++)
{
if (content[i].value == NULL)
{
@@ -203,6 +198,8 @@
discard_time = now;
GNUNET_free_non_null (content[discard_entry].value);
content[discard_entry].value = NULL;
+ GNUNET_FS_PT_decrement_rcs (content[discard_entry].receiverIndices,
+ content[discard_entry].sentCount);
content[discard_entry].sentCount = 0;
if (GNUNET_OK != datastore->getRandom (&content[discard_entry].key,
&content[discard_entry].value))
@@ -233,6 +230,7 @@
{
GNUNET_GE_ASSERT (NULL, 0);
GNUNET_mutex_unlock (GNUNET_FS_lock);
+ GNUNET_FS_PT_change_rc (index, -1);
return 0;
}
size =
@@ -247,6 +245,7 @@
size, padding);
#endif
GNUNET_mutex_unlock (GNUNET_FS_lock);
+ GNUNET_FS_PT_change_rc (index, -1);
return 0;
}
#if DEBUG_MIGRATION
@@ -261,6 +260,7 @@
GNUNET_free_non_null (value);
content[entry].value = NULL;
GNUNET_mutex_unlock (GNUNET_FS_lock);
+ GNUNET_FS_PT_change_rc (index, -1);
return 0;
}
if (ntohl (value->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND)
@@ -276,6 +276,7 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"Migration: failed to locate indexed content for
migration.\n");
#endif
+ GNUNET_FS_PT_change_rc (index, -1);
return 0;
}
if (stats != NULL)
@@ -296,6 +297,7 @@
"Migration: available content too big (%u > %u) for
migration.\n",
size, padding);
#endif
+ GNUNET_FS_PT_change_rc (index, -1);
return 0;
}
msg = position;
@@ -321,11 +323,14 @@
{
GNUNET_free (content[entry].value);
content[entry].value = NULL;
+ GNUNET_FS_PT_decrement_rcs (content[discard_entry].receiverIndices,
+ content[discard_entry].sentCount);
content[entry].sentCount = 0;
}
else
{
content[entry].receiverIndices[content[entry].sentCount++] = index;
+ GNUNET_FS_PT_change_rc (index, 1);
}
}
else
@@ -340,15 +345,88 @@
if ((ret > 0) && (stats != NULL))
stats->change (stat_migration_count, 1);
GNUNET_GE_BREAK (NULL, ret <= padding);
+ GNUNET_FS_PT_change_rc (index, -1);
return ret;
}
+#endif
+/**
+ * Make a piece of content that we have received
+ * available for transmission via migration.
+ *
+ * @param size size of value
+ * @param value the content to make available
+ * @param expiration expiration time for value
+ * @param blocked_size size of the list of PID_INDEX variables
+ * refering to peers that must NOT receive
+ * the content using migration
+ * @param block blocked peers
+ */
+void
+GNUNET_FS_MIGRATION_inject (const GNUNET_HashCode * key,
+ unsigned int size,
+ const DBlock * value,
+ GNUNET_CronTime expiration,
+ unsigned int blocked_size,
+ const PID_INDEX * blocked)
+{
+#if ENABLE_MIGRATION
+ int i;
+ int discard_entry;
+ int discard_count;
+ struct MigrationRecord *record;
+
+ if (content_size == 0)
+ return;
+ GNUNET_mutex_lock (GNUNET_FS_lock);
+ discard_entry = -1;
+ discard_count = 0;
+ for (i = 0; i < content_size; i++)
+ {
+ record = &content[i];
+ if (record->value == NULL)
+ {
+ discard_entry = i;
+ break;
+ }
+ if (discard_count < record->sentCount)
+ {
+ discard_entry = i;
+ discard_count = record->sentCount;
+ }
+ }
+ if (discard_entry == -1)
+ {
+ GNUNET_mutex_unlock (GNUNET_FS_lock);
+ return;
+ }
+ record = &content[discard_entry];
+ GNUNET_free_non_null (record->value);
+ record->value = NULL;
+ GNUNET_FS_PT_decrement_rcs (record->receiverIndices, record->sentCount);
+ record->sentCount = 0;
+ record->key = *key;
+ record->value = GNUNET_malloc (size + sizeof (GNUNET_DatastoreValue));
+ record->value->size = htonl (size + sizeof (GNUNET_DatastoreValue));
+ record->value->expirationTime = GNUNET_htonll (expiration);
+ record->value->anonymityLevel = 0;
+ record->value->type = value->type;
+ memcpy (&record->value[1], value, size);
+ for (i = 0; i < blocked_size; i++)
+ {
+ record->receiverIndices[i] = blocked[i];
+ GNUNET_FS_PT_change_rc (blocked[i], 1);
+ }
+ record->sentCount = blocked_size;
#endif
+}
void
GNUNET_FS_MIGRATION_init (GNUNET_CoreAPIForPlugins * capi)
{
#if ENABLE_MIGRATION
+ unsigned long long option_value;
+
coreAPI = capi;
coreAPI->
connection_register_send_callback
@@ -363,9 +441,14 @@
stat_migration_factor
= stats->create (gettext_noop ("# blocks fetched for migration"));
stat_on_demand_migration_attempts
- =
- stats->create (gettext_noop ("# on-demand block migration attempts"));
+ = stats->create (gettext_noop ("# on-demand fetches for migration"));
}
+ GNUNET_GC_get_configuration_value_number (capi->cfg,
+ "FS",
+ "MIGRATIONBUFFERSIZE",
+ 0,
+ 1024 * 1024, 64, &option_value);
+ GNUNET_array_grow (content, content_size, (unsigned int) option_value);
#endif
}
@@ -374,6 +457,8 @@
{
#if ENABLE_MIGRATION
int i;
+ struct MigrationRecord *record;
+
coreAPI->
connection_unregister_send_callback
(GNUNET_GAP_ESTIMATED_DATA_SIZE, &activeMigrationCallback);
@@ -385,11 +470,14 @@
coreAPI->release_service (datastore);
datastore = NULL;
coreAPI = NULL;
- for (i = 0; i < MAX_RECORDS; i++)
+ for (i = 0; i < content_size; i++)
{
- GNUNET_free_non_null (content[i].value);
- content[i].value = NULL;
+ record = &content[i];
+ GNUNET_free_non_null (record->value);
+ record->value = NULL;
+ GNUNET_FS_PT_decrement_rcs (record->receiverIndices, record->sentCount);
}
+ GNUNET_array_grow (content, content_size, 0);
lock = NULL;
#endif
}
Modified: GNUnet/src/applications/fs/gap/migration.h
===================================================================
--- GNUnet/src/applications/fs/gap/migration.h 2008-02-16 20:21:12 UTC (rev
6324)
+++ GNUnet/src/applications/fs/gap/migration.h 2008-02-16 21:03:06 UTC (rev
6325)
@@ -28,12 +28,34 @@
#define MIGRATION_H
#include "gnunet_core.h"
+#include "ecrs_core.h"
+#include "gnunet_datastore_service.h"
+#include "pid_table.h"
/**
* Initialize the migration module.
*/
void GNUNET_FS_MIGRATION_init (GNUNET_CoreAPIForPlugins * capi);
+/**
+ * Make a piece of content that we have received
+ * available for transmission via migration.
+ *
+ * @param size size of value
+ * @param value the content to make available
+ * @param expiration expiration time for value
+ * @param blocked_size size of the list of PID_INDEX variables
+ * refering to peers that must NOT receive
+ * the content using migration
+ * @param block blocked peers
+ */
+void GNUNET_FS_MIGRATION_inject (const GNUNET_HashCode * key,
+ unsigned int size,
+ const DBlock * value,
+ GNUNET_CronTime expiration,
+ unsigned int blocked_size,
+ const PID_INDEX * blocked);
+
void GNUNET_FS_MIGRATION_done (void);
/* end of migration.h */
Modified: GNUnet/src/applications/fs/gap/test_multi_results.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_multi_results.c 2008-02-16 20:21:12 UTC
(rev 6324)
+++ GNUnet/src/applications/fs/gap/test_multi_results.c 2008-02-16 21:03:06 UTC
(rev 6325)
@@ -55,7 +55,7 @@
testTerminate (void *unused)
{
/* wait for us to find 90% */
- return (found > (TOTAL*90)/100) ? GNUNET_SYSERR : GNUNET_OK;
+ return (found > (TOTAL * 90) / 100) ? GNUNET_SYSERR : GNUNET_OK;
}
static char *
@@ -92,8 +92,7 @@
1, /* anon */
0, /* prio */
GNUNET_get_time () + 100 *
GNUNET_CRON_MINUTES, /* expire */
- NULL,
- NULL, &testTerminate, NULL, &uri);
+ NULL, NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
{
struct GNUNET_ECRS_MetaData *meta;
@@ -103,8 +102,8 @@
uri, meta);
GNUNET_ECRS_meta_data_destroy (meta);
GNUNET_free (name);
- if (ret == GNUNET_OK)
- return uri;
+ if (ret == GNUNET_OK)
+ return uri;
GNUNET_ECRS_uri_destroy (uri);
return NULL;
}
@@ -122,19 +121,17 @@
{
int i;
- for (i=0;i<TOTAL;i++)
+ for (i = 0; i < TOTAL; i++)
{
- if ( (uris[i] != NULL) &&
- (GNUNET_ECRS_uri_test_equal(uris[i],
- fi->uri)) )
- {
- GNUNET_ECRS_uri_destroy (uris[i]);
- uris[i] = NULL;
- found++;
- fprintf(stderr,
- ".");
- return GNUNET_OK;
- }
+ if ((uris[i] != NULL) &&
+ (GNUNET_ECRS_uri_test_equal (uris[i], fi->uri)))
+ {
+ GNUNET_ECRS_uri_destroy (uris[i]);
+ uris[i] = NULL;
+ found++;
+ fprintf (stderr, ".");
+ return GNUNET_OK;
+ }
}
return GNUNET_OK;
}
@@ -152,11 +149,10 @@
int ret;
int i;
char buf[128];
- const char *keywords[] =
- {
- "multi-test",
- NULL,
- };
+ const char *keywords[] = {
+ "multi-test",
+ NULL,
+ };
ret = 0;
cfg = GNUNET_GC_create ();
@@ -190,28 +186,26 @@
}
key = GNUNET_ECRS_keyword_strings_to_uri (keywords);
fprintf (stderr, "Uploading...");
- for (i=0;i<TOTAL;i++)
+ for (i = 0; i < TOTAL; i++)
{
- uris[i] = uploadFile (i+1);
- CHECK(uris[i] != NULL);
- fprintf(stderr, ".");
+ uris[i] = uploadFile (i + 1);
+ CHECK (uris[i] != NULL);
+ fprintf (stderr, ".");
}
fprintf (stderr, "\nSearching...");
GNUNET_snprintf (buf, 128, "localhost:%u", 2077 + PEER_COUNT * 10);
GNUNET_GC_set_configuration_value_string (cfg, ectx, "NETWORK", "HOST",
buf);
-
+
GNUNET_ECRS_search (ectx,
- cfg,
- key, 1, &searchCB, NULL, &testTerminate, NULL);
- fprintf(stderr,
- "\n");
- CHECK (found > (TOTAL*90)/100);
+ cfg, key, 1, &searchCB, NULL, &testTerminate, NULL);
+ fprintf (stderr, "\n");
+ CHECK (found > (TOTAL * 90) / 100);
FAILURE:
#if START_PEERS
GNUNET_TESTING_stop_daemons (peers);
#endif
- GNUNET_ECRS_uri_destroy (key);
+ GNUNET_ECRS_uri_destroy (key);
GNUNET_GC_free (cfg);
return ret;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-auto-share.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-02-16
20:21:12 UTC (rev 6324)
+++ GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-02-16
21:03:06 UTC (rev 6325)
@@ -153,54 +153,48 @@
return GNUNET_OK;
}
-struct AddMetadataClosure {
- const char * filename;
- struct GNUNET_ECRS_MetaData * meta;
+struct AddMetadataClosure
+{
+ const char *filename;
+ struct GNUNET_ECRS_MetaData *meta;
};
static int
-add_meta_data(void * cls,
- struct GNUNET_GC_Configuration * cfg,
- struct GNUNET_GE_Context * ectx,
- const char * section,
- const char * option)
+add_meta_data (void *cls,
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
+ const char *section, const char *option)
{
- struct AddMetadataClosure * amc = cls;
+ struct AddMetadataClosure *amc = cls;
EXTRACTOR_KeywordType type;
EXTRACTOR_KeywordType max;
- char * value;
+ char *value;
- if (0 != strcmp(amc->filename,
- section) )
+ if (0 != strcmp (amc->filename, section))
return GNUNET_OK;
- max = EXTRACTOR_getHighestKeywordTypeNumber();
- for (type=0;type<max;type++)
+ max = EXTRACTOR_getHighestKeywordTypeNumber ();
+ for (type = 0; type < max; type++)
{
- if (0 == strcasecmp(option,
- EXTRACTOR_getKeywordTypeAsString(type)))
- break;
+ if (0 == strcasecmp (option, EXTRACTOR_getKeywordTypeAsString (type)))
+ break;
}
if (type == max)
{
- GNUNET_GE_LOG(ectx,
- GNUNET_GE_USER | GNUNET_GE_WARNING | GNUNET_GE_BULK,
- _("Unknown keyword type `%s' in metadata configuration\n"),
- option);
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_USER | GNUNET_GE_WARNING | GNUNET_GE_BULK,
+ _
+ ("Unknown keyword type `%s' in metadata configuration\n"),
+ option);
return GNUNET_OK;
}
value = NULL;
- GNUNET_GC_get_configuration_value_string(cfg,
- section,
- option,
- NULL,
- &value);
+ GNUNET_GC_get_configuration_value_string (cfg,
+ section, option, NULL, &value);
if (value != NULL)
{
- GNUNET_ECRS_meta_data_insert(amc->meta,
- type,
- value);
- GNUNET_free(value);
+ GNUNET_ECRS_meta_data_insert (amc->meta, type, value);
+ GNUNET_free (value);
}
return GNUNET_OK;
}
@@ -241,16 +235,12 @@
GNUNET_free (fn);
return GNUNET_OK;
}
- amc.meta = GNUNET_ECRS_meta_data_create();
+ amc.meta = GNUNET_ECRS_meta_data_create ();
amc.filename = filename;
/* attaching a listener will prompt iteration
over all config values! */
- GNUNET_GC_attach_change_listener(meta_cfg,
- &add_meta_data,
- &amc);
- GNUNET_GC_detach_change_listener(meta_cfg,
- &add_meta_data,
- &amc);
+ GNUNET_GC_attach_change_listener (meta_cfg, &add_meta_data, &amc);
+ GNUNET_GC_detach_change_listener (meta_cfg, &add_meta_data, &amc);
ul = GNUNET_FSUI_upload_start (ctx,
fn,
(GNUNET_FSUI_DirectoryScanCallback) &
@@ -259,7 +249,7 @@
!do_no_direct_references,
GNUNET_get_time () + 2 * GNUNET_CRON_YEARS,
amc.meta, gloKeywords, NULL);
- GNUNET_ECRS_meta_data_destroy(amc.meta);
+ GNUNET_ECRS_meta_data_destroy (amc.meta);
GNUNET_free (fn);
return GNUNET_SYSERR;
}
@@ -281,7 +271,7 @@
time_t last;
time_t start;
GNUNET_CronTime delay;
- char * metafn;
+ char *metafn;
errorCode = 0;
i = GNUNET_init (argc,
@@ -305,16 +295,14 @@
"GNUNET",
"VERBOSE", 0, 9999, 0, &verbose);
metafn = NULL;
- GNUNET_GC_get_configuration_value_filename(cfg,
- "FS",
- "METADATA",
- GNUNET_DEFAULT_HOME_DIRECTORY
"/metadata.conf",
- &metafn);
- meta_cfg = GNUNET_GC_create();
- if (GNUNET_YES ==
- GNUNET_disk_file_test(NULL, metafn))
- GNUNET_GC_parse_configuration(meta_cfg,
- metafn);
+ GNUNET_GC_get_configuration_value_filename (cfg,
+ "FS",
+ "METADATA",
+ GNUNET_DEFAULT_HOME_DIRECTORY
+ "/metadata.conf", &metafn);
+ meta_cfg = GNUNET_GC_create ();
+ if (GNUNET_YES == GNUNET_disk_file_test (NULL, metafn))
+ GNUNET_GC_parse_configuration (meta_cfg, metafn);
/* fundamental init */
ctx = GNUNET_FSUI_start (ectx, cfg, "gnunet-auto-share", GNUNET_NO, 32,
&printstatus, &verbose);
@@ -350,7 +338,7 @@
GNUNET_free (dirname);
quit:
if (meta_cfg != NULL)
- GNUNET_GC_free(meta_cfg);
+ GNUNET_GC_free (meta_cfg);
GNUNET_fini (ectx, cfg);
return errorCode;
}
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2008-02-16 20:21:12 UTC (rev
6324)
+++ GNUnet/src/applications/session/connect.c 2008-02-16 21:03:06 UTC (rev
6325)
@@ -601,7 +601,7 @@
("Session key received from peer `%s' has invalid format
(discarded).\n"),
&enc);
return GNUNET_SYSERR;
- }
+ }
load = GNUNET_cpu_get_load (ectx, coreAPI->cfg);
if ((GNUNET_OK !=
coreAPI->connection_get_session_key_of_peer (sender, NULL,
@@ -790,9 +790,9 @@
ping->type = htons (GNUNET_P2P_PROTO_PONG);
if (stats != NULL)
stats->change (stat_pongSent, 1);
- GNUNET_mutex_lock(lock);
+ GNUNET_mutex_lock (lock);
exchangeKey (sender, tsession, ping); /* ping is now pong */
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
}
else
{
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2008-02-16 20:21:12 UTC
(rev 6324)
+++ GNUnet/src/applications/topology_default/topology.c 2008-02-16 21:03:06 UTC
(rev 6325)
@@ -536,8 +536,7 @@
return GNUNET_SYSERR;
}
}
- if ( (fn != NULL) &&
- (size > 0) )
+ if ((fn != NULL) && (size > 0))
{
data = GNUNET_malloc (size);
if (size != GNUNET_disk_file_read (ectx, fn, size, data))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6325 - in GNUnet: contrib src/applications/chat src/applications/dht/module src/applications/fs/gap src/applications/fs/tools src/applications/session src/applications/topology_default,
gnunet <=