[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33142 - in gnunet/src: include peerstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33142 - in gnunet/src: include peerstore |
Date: |
Fri, 25 Apr 2014 20:00:04 +0200 |
Author: otarabai
Date: 2014-04-25 20:00:04 +0200 (Fri, 25 Apr 2014)
New Revision: 33142
Added:
gnunet/src/peerstore/plugin_peerstore_file.c
Modified:
gnunet/src/include/gnunet_peerstore_plugin.h
gnunet/src/peerstore/Makefile.am
gnunet/src/peerstore/gnunet-service-peerstore.c
Log:
towards PEERSTORE file plugin
Modified: gnunet/src/include/gnunet_peerstore_plugin.h
===================================================================
--- gnunet/src/include/gnunet_peerstore_plugin.h 2014-04-25 07:59:45 UTC
(rev 33141)
+++ gnunet/src/include/gnunet_peerstore_plugin.h 2014-04-25 18:00:04 UTC
(rev 33142)
@@ -59,5 +59,5 @@
}
#endif
-/* end of gnunet_namestore_plugin.h */
+/* end of gnunet_peerstore_plugin.h */
#endif
Modified: gnunet/src/peerstore/Makefile.am
===================================================================
--- gnunet/src/peerstore/Makefile.am 2014-04-25 07:59:45 UTC (rev 33141)
+++ gnunet/src/peerstore/Makefile.am 2014-04-25 18:00:04 UTC (rev 33142)
@@ -1,5 +1,7 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/include
+plugindir = $(libdir)/gnunet
+
pkgcfgdir= $(pkgdatadir)/config.d/
libexecdir= $(pkglibdir)/libexec/
@@ -44,6 +46,21 @@
libgnunetpeerstore_la_LDFLAGS = \
$(GNUNET_LDFLAGS)
+plugin_LTLIBRARIES = \
+ libgnunet_plugin_peerstore_file.la
+
+libgnunet_plugin_peerstore_file_la_SOURCES = \
+ plugin_peerstore_file.c
+libgnunet_plugin_peerstore_file_la_LIBADD = \
+ $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(LTLIBINTL)
+libgnunet_plugin_peerstore_file_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+libgnunet_plugin_peerstore_file_la_DEPENDENCIES = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ libgnunetpeerstore.la
+
check_PROGRAMS = \
test_peerstore_api
Modified: gnunet/src/peerstore/gnunet-service-peerstore.c
===================================================================
--- gnunet/src/peerstore/gnunet-service-peerstore.c 2014-04-25 07:59:45 UTC
(rev 33141)
+++ gnunet/src/peerstore/gnunet-service-peerstore.c 2014-04-25 18:00:04 UTC
(rev 33142)
@@ -33,6 +33,11 @@
static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
+ * Database handle
+ */
+static struct GNUNET_PEERSTORE_PluginFunctions *db;
+
+/**
* Task run during shutdown.
*
* @param cls unused
@@ -80,16 +85,23 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, "peerstore", "DATABASE",
&database))
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n");
+
+ else
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n");
- return;
+ GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_peerstore_%s", database);
+ db = GNUNET_PLUGIN_load(db_lib_name, (void *) cfg);
+ GNUNET_free(database);
}
- GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_peerstore_%s", database);
-
- GNUNET_SERVER_add_handlers (server, handlers);
- GNUNET_SERVER_disconnect_notify (server,
- &handle_client_disconnect,
- NULL);
+ if(NULL == db)
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not load database backend
`%s'\n", db_lib_name);
+ else
+ {
+ GNUNET_SERVER_add_handlers (server, handlers);
+ GNUNET_SERVER_disconnect_notify (server,
+ &handle_client_disconnect,
+ NULL);
+ }
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task,
NULL);
Added: gnunet/src/peerstore/plugin_peerstore_file.c
===================================================================
--- gnunet/src/peerstore/plugin_peerstore_file.c
(rev 0)
+++ gnunet/src/peerstore/plugin_peerstore_file.c 2014-04-25 18:00:04 UTC
(rev 33142)
@@ -0,0 +1,33 @@
+/*
+ * This file is part of GNUnet
+ * (C) 2013 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
+ * by the Free Software Foundation; either version 3, or (at your
+ * option) any later version.
+ *
+ * GNUnet is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNUnet; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * @file peerstore/plugin_peerstore_file.c
+ * @brief file-based peerstore backend
+ * @author Omar Tarabai
+ */
+
+#include "platform.h"
+#include "gnunet_peerstore_plugin.h"
+#include "gnunet_peerstore_service.h"
+#include "peerstore.h"
+
+
+/* end of plugin_peerstore_file.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33142 - in gnunet/src: include peerstore,
gnunet <=