[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17970 - in gnunet: . src/block
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17970 - in gnunet: . src/block |
Date: |
Thu, 3 Nov 2011 21:41:05 +0100 |
Author: grothoff
Date: 2011-11-03 21:41:05 +0100 (Thu, 03 Nov 2011)
New Revision: 17970
Removed:
gnunet/src/block/block.conf
Modified:
gnunet/TODO
gnunet/src/block/Makefile.am
gnunet/src/block/block.c
Log:
fix #1746
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2011-11-03 17:15:45 UTC (rev 17969)
+++ gnunet/TODO 2011-11-03 20:41:05 UTC (rev 17970)
@@ -1,9 +1,7 @@
-0.9.0pre4:
+0.9.0:
* GNUNET-GTK: [CG]
- provide context menus to allow aborts of downloads/uploads
- provide way to handle errors (search, download, publish errors)
-
-0.9.0:
* new webpage:
- write chapter on DHT/block [Nate]
- make a NICE download page
@@ -17,6 +15,8 @@
+ insert
+ download
+ search
+* blocks:
+ + should block plugins live in block/ or with fs/dht/vpn?
0.9.1:
* TRANSPORT: [MW]
@@ -24,7 +24,7 @@
queue of size > 2), might be better to have at MOST one message pending
per plugin/target and only send the next one after the continuation was
called (or use 'notify_transmit_ready-style API?)
- - WLAN transport backend [DB]
+ - WLAN transport backend (code cleanup) [MW]
- need to periodically probe latency/transport cost changes & possibly
switch transport
(working ATS)
* DV:
Modified: gnunet/src/block/Makefile.am
===================================================================
--- gnunet/src/block/Makefile.am 2011-11-03 17:15:45 UTC (rev 17969)
+++ gnunet/src/block/Makefile.am 2011-11-03 20:41:05 UTC (rev 17970)
@@ -2,11 +2,6 @@
plugindir = $(libdir)/gnunet
-pkgcfgdir= $(pkgdatadir)/config.d/
-
-dist_pkgcfg_DATA = \
- block.conf
-
if MINGW
WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
endif
@@ -45,8 +40,8 @@
$(GN_PLUGIN_LDFLAGS)
libgnunet_plugin_block_fs_la_DEPENDENCIES = \
libgnunetblock.la
-
+
libgnunet_plugin_block_dns_la_SOURCES = \
plugin_block_dns.c
libgnunet_plugin_block_dns_la_LIBADD = \
Modified: gnunet/src/block/block.c
===================================================================
--- gnunet/src/block/block.c 2011-11-03 17:15:45 UTC (rev 17969)
+++ gnunet/src/block/block.c 2011-11-03 20:41:05 UTC (rev 17970)
@@ -54,11 +54,16 @@
struct GNUNET_BLOCK_Context
{
/**
- * NULL-terminated array of our plugins.
+ * Array of our plugins.
*/
struct Plugin **plugins;
/**
+ * Size of the 'plugins' array.
+ */
+ unsigned int num_plugins;
+
+ /**
* Our configuration.
*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -84,6 +89,33 @@
/**
+ * Add a plugin to the list managed by the block library.
+ *
+ * @param cls the block context
+ * @param library_name name of the plugin
+ * @param lib_ret the plugin API
+ */
+static void
+add_plugin (void *cls,
+ const char *library_name,
+ void *lib_ret)
+{
+ struct GNUNET_BLOCK_Context *ctx = cls;
+ struct GNUNET_BLOCK_PluginFunctions *api = lib_ret;
+ struct Plugin *plugin;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Loading block plugin `%s'\n"),
+ library_name);
+ plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin->api = api;
+ plugin->library_name = GNUNET_strdup (library_name);
+ GNUNET_array_append (ctx->plugins, ctx->num_plugins, plugin);
+}
+
+
+
+/**
* Create a block context. Loads the block plugins.
*
* @param cfg configuration to use
@@ -93,44 +125,13 @@
GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_BLOCK_Context *ctx;
- struct GNUNET_BLOCK_PluginFunctions *api;
- struct Plugin *plugin;
- unsigned int num_plugins;
- char *plugs;
- char *pos;
- char *libname;
ctx = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_Context));
ctx->cfg = cfg;
- num_plugins = 0;
- if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_string (cfg, "block", "PLUGINS", &plugs))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading block plugins `%s'\n"),
- plugs);
- pos = strtok (plugs, " ");
- while (pos != NULL)
- {
- GNUNET_asprintf (&libname, "libgnunet_plugin_block_%s", pos);
- api = GNUNET_PLUGIN_load (libname, NULL);
- if (api == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to load block plugin `%s'\n"), pos);
- GNUNET_free (libname);
- }
- else
- {
- plugin = GNUNET_malloc (sizeof (struct Plugin));
- plugin->api = api;
- plugin->library_name = libname;
- GNUNET_array_append (ctx->plugins, num_plugins, plugin);
- }
- pos = strtok (NULL, " ");
- }
- GNUNET_free (plugs);
- }
- GNUNET_array_append (ctx->plugins, num_plugins, NULL);
+ GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_",
+ NULL,
+ &add_plugin,
+ ctx);
return ctx;
}
@@ -146,14 +147,13 @@
unsigned int i;
struct Plugin *plugin;
- i = 0;
- while (NULL != (plugin = ctx->plugins[i]))
+ for (i = 0; i<ctx->num_plugins;i++)
{
+ plugin = ctx->plugins[i];
GNUNET_break (NULL ==
GNUNET_PLUGIN_unload (plugin->library_name, plugin->api));
GNUNET_free (plugin->library_name);
GNUNET_free (plugin);
- i++;
}
GNUNET_free (ctx->plugins);
GNUNET_free (ctx);
@@ -174,9 +174,9 @@
unsigned int i;
unsigned int j;
- i = 0;
- while (NULL != (plugin = ctx->plugins[i]))
+ for (i=0;i<ctx->num_plugins;i++)
{
+ plugin = ctx->plugins[i];
j = 0;
while (0 != (plugin->api->types[j]))
{
@@ -184,7 +184,6 @@
return plugin->api;
j++;
}
- i++;
}
return NULL;
}
Deleted: gnunet/src/block/block.conf
===================================================================
--- gnunet/src/block/block.conf 2011-11-03 17:15:45 UTC (rev 17969)
+++ gnunet/src/block/block.conf 2011-11-03 20:41:05 UTC (rev 17970)
@@ -1,2 +0,0 @@
-[block]
-PLUGINS = fs dht test dns
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17970 - in gnunet: . src/block,
gnunet <=