From: Christian Grothoff Date: Fri, 12 Mar 2010 16:16:01 +0000 (+0000) Subject: better clean up X-Git-Tag: initial-import-from-subversion-38251~22486 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ce5766138d2e443b8d13bdc5d5134a1a78745cab;p=oweals%2Fgnunet.git better clean up --- diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 1454504e8..9f5d594b5 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -1263,8 +1263,11 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) tcc_tail, tcc); if (tcc->th != NULL) - GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th); - if (NULL != tcc->tc) + { + GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th); + GNUNET_SERVER_client_drop (tcc->client); + } + if (NULL != tcc->tc) tcc->tc (tcc->tc_cls, GNUNET_SYSERR); GNUNET_free (tcc->msg); GNUNET_free (tcc); diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 78b453349..60c419092 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -132,6 +132,11 @@ struct Plugin */ struct GNUNET_STATISTICS_GetHandle *stat_get; + /** + * Closure of the 'next_task' (must be freed if 'next_task' is cancelled). + */ + struct NextContext *next_task_nc; + /** * Pending task with scheduler for running the next request. */ @@ -533,7 +538,7 @@ static void sqlite_next_request_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - struct NextContext * nc= cls; + struct NextContext * nc = cls; struct Plugin *plugin; unsigned long long rowid; sqlite3_stmt *stmtd; @@ -548,6 +553,7 @@ sqlite_next_request_cont (void *cls, plugin = nc->plugin; plugin->next_task = GNUNET_SCHEDULER_NO_TASK; + plugin->next_task_nc = NULL; if ( (GNUNET_YES == nc->end_it) || (GNUNET_OK != (nc->prep(nc->prep_cls, nc))) ) @@ -673,6 +679,7 @@ sqlite_next_request (void *next_cls, if (GNUNET_YES == end_it) nc->end_it = GNUNET_YES; + nc->plugin->next_task_nc = nc; nc->plugin->next_task = GNUNET_SCHEDULER_add_now (nc->plugin->env->sched, &sqlite_next_request_cont, nc); @@ -1655,6 +1662,9 @@ libgnunet_plugin_datastore_sqlite_done (void *cls) GNUNET_SCHEDULER_cancel (plugin->env->sched, plugin->next_task); plugin->next_task = GNUNET_SCHEDULER_NO_TASK; + plugin->next_task_nc->prep (plugin->next_task_nc->prep_cls, NULL); + GNUNET_free (plugin->next_task_nc); + plugin->next_task_nc = NULL; } fn = NULL; if (plugin->drop_on_shutdown) diff --git a/src/datastore/test_datastore_api_data.conf b/src/datastore/test_datastore_api_data.conf index 32b948c59..6a92a00b3 100644 --- a/src/datastore/test_datastore_api_data.conf +++ b/src/datastore/test_datastore_api_data.conf @@ -31,6 +31,8 @@ DATABASE = sqlite # REJECT_FROM = # REJECT_FROM6 = # PREFIX = +#PREFIX = valgrind --tool=memcheck --leak-check=yes +#BINARY = /home/grothoff/bin/gnunet-service-datastore [statistics] PORT = 22667