aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/plugin_datastore_sqlite.c
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2010-05-12 15:01:03 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2010-05-12 15:01:03 +0000
commit9903ea342dda809c0c907d1fc301299beeb8cdf3 (patch)
treef26c83bd6260c7010f58aafd5a5f6c2576cbef55 /src/datastore/plugin_datastore_sqlite.c
parent331981cfba81b263f0688e42e612b41ae526198a (diff)
adding support for request queueing to datastore API
git-svn-id: https://gnunet.org/svn/gnunet@11355 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r--src/datastore/plugin_datastore_sqlite.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index 9a387bb146..1576cef006 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -258,11 +258,21 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
"datastore-sqlite");
return GNUNET_SYSERR;
}
- if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (afsdir))
+ if (GNUNET_OK != GNUNET_DISK_file_test (afsdir))
{
- GNUNET_break (0);
- GNUNET_free (afsdir);
- return GNUNET_SYSERR;
+ if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (afsdir))
+ {
+ GNUNET_break (0);
+ GNUNET_free (afsdir);
+ return GNUNET_SYSERR;
+ }
+ /* database is new or got deleted, reset payload to zero! */
+ if (plugin->stat_get != NULL)
+ {
+ GNUNET_STATISTICS_get_cancel (plugin->stat_get);
+ plugin->stat_get = NULL;
+ }
+ plugin->payload = 0;
}
plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir),
#ifdef ENABLE_NLS
@@ -779,6 +789,9 @@ sqlite_plugin_put (void *cls,
LOG_SQLITE (plugin, msg,
GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_step");
sqlite3_reset (stmt);
+ database_shutdown (plugin);
+ database_setup (plugin->env->cfg,
+ plugin);
return GNUNET_SYSERR;
}
if (SQLITE_OK != sqlite3_reset (stmt))