fix
authorChristian Grothoff <christian@grothoff.org>
Fri, 6 May 2011 15:05:46 +0000 (15:05 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 6 May 2011 15:05:46 +0000 (15:05 +0000)
src/datastore/gnunet-service-datastore.c
src/datastore/plugin_datastore_postgres.c

index a0d5f7babe649745b73338ab74eea9a57dbd7f49..f95f09921e49c2709f4a99463ab48e4a7e51360f 100644 (file)
@@ -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)
index cb077f06a892a9b86c83b21bb48c284484564aef..30a6c20da851e76db74ac8afb14565b3168a54c7 100644 (file)
@@ -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__);
 }