From 399643b49e9564eead88548fa78e9bf259d8b3c3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 6 May 2011 15:05:46 +0000 Subject: [PATCH] fix --- src/datastore/gnunet-service-datastore.c | 9 ++++++++- src/datastore/plugin_datastore_postgres.c | 13 +++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index a0d5f7bab..f95f09921 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -144,6 +144,11 @@ static struct GNUNET_CONTAINER_BloomFilter *filter; */ static unsigned long long quota; +/** + * Should the database be dropped on exit? + */ +static int do_drop; + /** * How much space are we using for the cache? (space available for * insertions that will be instantly reclaimed by discarding less @@ -1342,7 +1347,7 @@ handle_drop (void *cls, "Processing `%s' request\n", "DROP"); #endif - plugin->api->drop (plugin->api->cls); + do_drop = GNUNET_YES; GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -1490,6 +1495,8 @@ static void unload_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { + if (GNUNET_YES == do_drop) + plugin->api->drop (plugin->api->cls); unload_plugin (plugin); plugin = NULL; if (filter != NULL) diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index cb077f06a..30a6c20da 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -525,7 +525,8 @@ postgres_plugin_put (void *cls, static void process_result (struct Plugin *plugin, PluginDatumProcessor proc, void *proc_cls, - PGresult *res) + PGresult *res, + int line) { int iret; enum GNUNET_BLOCK_Type type; @@ -541,7 +542,7 @@ process_result (struct Plugin *plugin, PGRES_TUPLES_OK, "PQexecPrepared", "select", - __LINE__)) + line)) { #if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, @@ -800,7 +801,7 @@ postgres_plugin_get_key (void *cls, paramFormats, 1); process_result (plugin, proc, proc_cls, - ret); + ret, __LINE__); } @@ -839,7 +840,7 @@ postgres_plugin_get_zero_anonymity (void *cls, paramFormats, 1); process_result (plugin, proc, proc_cls, - ret); + ret, __LINE__); } @@ -961,7 +962,7 @@ postgres_plugin_get_replication (void *cls, NULL, NULL, NULL, 1); process_result (plugin, &repl_proc, &rc, - ret); + ret, __LINE__); } @@ -994,7 +995,7 @@ postgres_plugin_get_expiration (void *cls, 1); process_result (plugin, proc, proc_cls, - ret); + ret, __LINE__); } -- 2.25.1