[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12491 - in gnunet: contrib src/datastore src/include src/u
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12491 - in gnunet: contrib src/datastore src/include src/util |
Date: |
Sat, 7 Aug 2010 18:55:16 +0200 |
Author: grothoff
Date: 2010-08-07 18:55:16 +0200 (Sat, 07 Aug 2010)
New Revision: 12491
Modified:
gnunet/contrib/defaults.conf
gnunet/src/datastore/datastore_api.c
gnunet/src/datastore/gnunet-service-datastore.c
gnunet/src/datastore/perf_datastore_api.c
gnunet/src/datastore/perf_plugin_datastore.c
gnunet/src/datastore/perf_plugin_datastore_data_mysql.conf
gnunet/src/datastore/test_datastore_api.c
gnunet/src/datastore/test_datastore_api_management.c
gnunet/src/include/gnunet_block_lib.h
gnunet/src/include/gnunet_fs_service.h
gnunet/src/util/bio.c
Log:
do not fail if datastore unavailable
Modified: gnunet/contrib/defaults.conf
===================================================================
--- gnunet/contrib/defaults.conf 2010-08-07 16:54:29 UTC (rev 12490)
+++ gnunet/contrib/defaults.conf 2010-08-07 16:55:16 UTC (rev 12491)
@@ -211,6 +211,7 @@
TRUST = $SERVICEHOME/data/credit/
IDENTITY_DIR = $SERVICEHOME/identities/
STATE_DIR = $SERVICEHOME/persistence/
+UPDATE_DIR = $SERVICEHOME/updates/
PORT = 2094
HOSTNAME = localhost
HOME = $SERVICEHOME
Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c 2010-08-07 16:54:29 UTC (rev
12490)
+++ gnunet/src/datastore/datastore_api.c 2010-08-07 16:55:16 UTC (rev
12491)
@@ -682,14 +682,13 @@
if (msg == NULL)
{
free_queue_entry (qe);
+ rc.cont (rc.cont_cls,
+ GNUNET_SYSERR,
+ _("Failed to receive response from database."));
if (NULL == h->client)
return; /* forced disconnect */
if (was_transmitted == GNUNET_YES)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to receive response from database.\n"));
- do_disconnect (h);
- }
+ do_disconnect (h);
return;
}
GNUNET_assert (GNUNET_YES == qe->was_transmitted);
@@ -1079,7 +1078,7 @@
h->in_receive = GNUNET_NO;
if (msg == NULL)
- {
+ {
was_transmitted = qe->was_transmitted;
free_queue_entry (qe);
if (was_transmitted == GNUNET_YES)
Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c 2010-08-07 16:54:29 UTC
(rev 12490)
+++ gnunet/src/datastore/gnunet-service-datastore.c 2010-08-07 16:55:16 UTC
(rev 12491)
@@ -1623,7 +1623,6 @@
GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_UNIT_FOREVER_REL,
&cleaning_task, NULL);
-
}
Modified: gnunet/src/datastore/perf_datastore_api.c
===================================================================
--- gnunet/src/datastore/perf_datastore_api.c 2010-08-07 16:54:29 UTC (rev
12490)
+++ gnunet/src/datastore/perf_datastore_api.c 2010-08-07 16:55:16 UTC (rev
12491)
@@ -314,7 +314,30 @@
}
+
static void
+run_tests (void *cls,
+ int success,
+ const char *msg)
+{
+ struct CpsRunContext *crc = cls;
+
+ if (success != GNUNET_YES)
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed with error `%s' database likely not
setup, skipping test.",
+ msg);
+ GNUNET_free (crc);
+ return;
+ }
+ GNUNET_SCHEDULER_add_continuation (crc->sched,
+ &run_continuation,
+ crc,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+}
+
+
+static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
@@ -322,6 +345,7 @@
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
+ static GNUNET_HashCode zkey;
datastore = GNUNET_DATASTORE_connect (cfg, sched);
start_time = GNUNET_TIME_absolute_get ();
@@ -329,10 +353,19 @@
crc->sched = sched;
crc->cfg = cfg;
crc->phase = RP_PUT;
- GNUNET_SCHEDULER_add_continuation (crc->sched,
- &run_continuation,
- crc,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+ if (NULL ==
+ GNUNET_DATASTORE_put (datastore, 0,
+ &zkey, 4, "TEST",
+ GNUNET_BLOCK_TYPE_TEST,
+ 0, 0, GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_SECONDS),
+ 0, 1, GNUNET_TIME_UNIT_MINUTES,
+ &run_tests, crc))
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed.\n");
+ ok = 1;
+ GNUNET_free (crc);
+ }
}
Modified: gnunet/src/datastore/perf_plugin_datastore.c
===================================================================
--- gnunet/src/datastore/perf_plugin_datastore.c 2010-08-07 16:54:29 UTC
(rev 12490)
+++ gnunet/src/datastore/perf_plugin_datastore.c 2010-08-07 16:55:16 UTC
(rev 12491)
@@ -334,7 +334,13 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Loading `%s' datastore plugin\n"), name);
GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
- GNUNET_assert (NULL != (ret = GNUNET_PLUGIN_load (libname, &env)));
+ if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
+ {
+ fprintf (stderr,
+ "Failed to load plugin `%s'!\n",
+ name);
+ return NULL;
+ }
GNUNET_free (libname);
GNUNET_free (name);
return ret;
@@ -352,15 +358,19 @@
struct CpsRunContext *crc;
api = load_plugin (c, s);
- GNUNET_assert (api != NULL);
+ if (api == NULL)
+ {
+ fprintf (stderr,
+ "Could not initialize plugin, assuming database not configured.
Test not run!\n");
+ return;
+ }
crc = GNUNET_malloc(sizeof(struct CpsRunContext));
crc->api = api;
crc->sched = s;
crc->cfg = c;
crc->phase = RP_PUT;
- GNUNET_SCHEDULER_add_after (s,
- GNUNET_SCHEDULER_NO_TASK,
- &test, crc);
+ GNUNET_SCHEDULER_add_now (crc->sched,
+ &test, crc);
}
Modified: gnunet/src/datastore/perf_plugin_datastore_data_mysql.conf
===================================================================
--- gnunet/src/datastore/perf_plugin_datastore_data_mysql.conf 2010-08-07
16:54:29 UTC (rev 12490)
+++ gnunet/src/datastore/perf_plugin_datastore_data_mysql.conf 2010-08-07
16:55:16 UTC (rev 12491)
@@ -21,6 +21,7 @@
# REJECT_FROM6 =
# PREFIX =
+
[dht]
AUTOSTART = NO
Modified: gnunet/src/datastore/test_datastore_api.c
===================================================================
--- gnunet/src/datastore/test_datastore_api.c 2010-08-07 16:54:29 UTC (rev
12490)
+++ gnunet/src/datastore/test_datastore_api.c 2010-08-07 16:55:16 UTC (rev
12491)
@@ -583,6 +583,28 @@
static void
+run_tests (void *cls,
+ int success,
+ const char *msg)
+{
+ struct CpsRunContext *crc = cls;
+
+ if (success != GNUNET_YES)
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed with error `%s' database likely not
setup, skipping test.",
+ msg);
+ GNUNET_free (crc);
+ return;
+ }
+ GNUNET_SCHEDULER_add_continuation (crc->sched,
+ &run_continuation,
+ crc,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+}
+
+
+static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
@@ -590,6 +612,7 @@
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
+ static GNUNET_HashCode zkey;
crc = GNUNET_malloc(sizeof(struct CpsRunContext));
crc->sched = sched;
@@ -597,15 +620,22 @@
crc->phase = RP_PUT;
now = GNUNET_TIME_absolute_get ();
datastore = GNUNET_DATASTORE_connect (cfg, sched);
- GNUNET_SCHEDULER_add_continuation (crc->sched,
- &run_continuation,
- crc,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
-
+ if (NULL ==
+ GNUNET_DATASTORE_put (datastore, 0,
+ &zkey, 4, "TEST",
+ GNUNET_BLOCK_TYPE_TEST,
+ 0, 0, GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_SECONDS),
+ 0, 1, GNUNET_TIME_UNIT_MINUTES,
+ &run_tests, crc))
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed.\n");
+ ok = 1;
+ GNUNET_free (crc);
+ }
}
-
static int
check ()
{
Modified: gnunet/src/datastore/test_datastore_api_management.c
===================================================================
--- gnunet/src/datastore/test_datastore_api_management.c 2010-08-07
16:54:29 UTC (rev 12490)
+++ gnunet/src/datastore/test_datastore_api_management.c 2010-08-07
16:55:16 UTC (rev 12491)
@@ -293,6 +293,28 @@
static void
+run_tests (void *cls,
+ int success,
+ const char *msg)
+{
+ struct CpsRunContext *crc = cls;
+
+ if (success != GNUNET_YES)
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed with error `%s' database likely not
setup, skipping test.",
+ msg);
+ GNUNET_free (crc);
+ return;
+ }
+ GNUNET_SCHEDULER_add_continuation (crc->sched,
+ &run_continuation,
+ crc,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+}
+
+
+static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
@@ -300,6 +322,7 @@
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
+ static GNUNET_HashCode zkey;
crc = GNUNET_malloc(sizeof(struct CpsRunContext));
crc->sched = sched;
@@ -307,11 +330,19 @@
crc->phase = RP_PUT;
now = GNUNET_TIME_absolute_get ();
datastore = GNUNET_DATASTORE_connect (cfg, sched);
- GNUNET_SCHEDULER_add_continuation (crc->sched,
- &run_continuation,
- crc,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
-
+ if (NULL ==
+ GNUNET_DATASTORE_put (datastore, 0,
+ &zkey, 4, "TEST",
+ GNUNET_BLOCK_TYPE_TEST,
+ 0, 0, GNUNET_TIME_relative_to_absolute
(GNUNET_TIME_UNIT_SECONDS),
+ 0, 1, GNUNET_TIME_UNIT_MINUTES,
+ &run_tests, crc))
+ {
+ fprintf (stderr,
+ "Test 'put' operation failed.\n");
+ GNUNET_free (crc);
+ ok = 1;
+ }
}
Modified: gnunet/src/include/gnunet_block_lib.h
===================================================================
--- gnunet/src/include/gnunet_block_lib.h 2010-08-07 16:54:29 UTC (rev
12490)
+++ gnunet/src/include/gnunet_block_lib.h 2010-08-07 16:55:16 UTC (rev
12491)
@@ -75,8 +75,10 @@
/**
* Type of a block that is used to advertise a namespace.
*/
- GNUNET_BLOCK_TYPE_NBLOCK = 6
+ GNUNET_BLOCK_TYPE_NBLOCK = 6,
+ GNUNET_BLOCK_TYPE_TEST = 9999
+
};
Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h 2010-08-07 16:54:29 UTC (rev
12490)
+++ gnunet/src/include/gnunet_fs_service.h 2010-08-07 16:55:16 UTC (rev
12491)
@@ -2243,15 +2243,28 @@
/**
- * List all of the identifiers in the namespace for
- * which we could produce an update.
+ * List all of the identifiers in the namespace for which we could
+ * produce an update. Namespace updates form a graph where each node
+ * has a name. Each node can have any number of URI/meta-data entries
+ * which can each be linked to other nodes. Cycles are possible.
+ *
+ * Calling this function with "next_id" NULL will cause the library to
+ * call "ip" with a root for each strongly connected component of the
+ * graph (a root being a node from which all other nodes in the Scc
+ * are reachable).
+ *
+ * Calling this function with "next_id" being the name of a node will
+ * cause the library to call "ip" with all children of the node. Note
+ * that cycles within an SCC are possible (including self-loops).
*
* @param namespace namespace to inspect for updateable content
+ * @param next_id ID to look for; use NULL to look for SCC roots
* @param ip function to call on each updateable identifier
* @param ip_cls closure for ip
*/
void
GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace,
+ const char *next_id,
GNUNET_FS_IdentifierProcessor ip,
void *ip_cls);
Modified: gnunet/src/util/bio.c
===================================================================
--- gnunet/src/util/bio.c 2010-08-07 16:54:29 UTC (rev 12490)
+++ gnunet/src/util/bio.c 2010-08-07 16:55:16 UTC (rev 12491)
@@ -79,10 +79,16 @@
int
GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg)
{
- *emsg = h->emsg;
+ int err;
+
+ err = (NULL == h->emsg) ? GNUNET_OK : GNUNET_SYSERR;
+ if (emsg != NULL)
+ *emsg = h->emsg;
+ else
+ GNUNET_free_non_null (h->emsg);
GNUNET_DISK_file_close (h->fd);
GNUNET_free (h);
- return (NULL == *emsg) ? GNUNET_OK : GNUNET_SYSERR;
+ return err;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12491 - in gnunet: contrib src/datastore src/include src/util,
gnunet <=