"libgnunet_plugin_namestore_%s",
database);
ns = GNUNET_PLUGIN_load (db_lib_name,
- (void *) cfg);
+ (void *) cfg);
GNUNET_free (database);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
+ if (NULL == ns)
+ {
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
id = GNUNET_IDENTITY_connect (cfg,
&identity_cb,
NULL);
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
}
[namestore-postgres]
+# How to connect to the database
CONFIG = postgres:///gnunet
+# Use temporary tables
TEMPORARY_TABLE = NO
+# Use asynchronous commit (SET synchronous_commit TO OFF).
+ASYNC_COMMIT = NO
[uri]
gns = gnunet-namestore
"namestore-postgres");
if (NULL == plugin->dbh)
return GNUNET_SYSERR;
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
+ "namestore-postgres",
+ "ASYNC_COMMIT"))
+ {
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_try_execute ("SET synchronous_commit TO off"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_PQ_exec_statements (plugin->dbh,
+ es))
+ {
+ PQfinish (plugin->dbh);
+ plugin->dbh = NULL;
+ return GNUNET_SYSERR;
+ }
+ }
if (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
"namestore-postgres",