diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-03-12 13:29:05 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-03-12 13:29:05 +0000 |
commit | 371962d5e6b78462ca7646dc971697968a726313 (patch) | |
tree | fc2dacc6a36f3ec04cf86a14cdea9c5bdf45274f /src/datastore/plugin_datastore_sqlite.c | |
parent | 3e3591494a1bd1ab65e907ba47e19e590644e1d5 (diff) |
cancel pending write if we are just dead anyway
git-svn-id: https://gnunet.org/svn/gnunet@10564 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 9356b79edc..78b4533499 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -131,6 +131,11 @@ struct Plugin * Handle for pending get request. */ struct GNUNET_STATISTICS_GetHandle *stat_get; + + /** + * Pending task with scheduler for running the next request. + */ + GNUNET_SCHEDULER_TaskIdentifier next_task; /** * How much data are we currently storing @@ -540,9 +545,9 @@ sqlite_next_request_cont (void *cls, struct GNUNET_TIME_Absolute expiration; const GNUNET_HashCode *key; const void *data; - - + plugin = nc->plugin; + plugin->next_task = GNUNET_SCHEDULER_NO_TASK; if ( (GNUNET_YES == nc->end_it) || (GNUNET_OK != (nc->prep(nc->prep_cls, nc))) ) @@ -668,10 +673,9 @@ sqlite_next_request (void *next_cls, if (GNUNET_YES == end_it) nc->end_it = GNUNET_YES; - GNUNET_SCHEDULER_add_continuation (nc->plugin->env->sched, - &sqlite_next_request_cont, - nc, - GNUNET_SCHEDULER_REASON_PREREQ_DONE); + nc->plugin->next_task = GNUNET_SCHEDULER_add_now (nc->plugin->env->sched, + &sqlite_next_request_cont, + nc); } @@ -1646,6 +1650,12 @@ libgnunet_plugin_datastore_sqlite_done (void *cls) GNUNET_STATISTICS_get_cancel (plugin->stat_get); plugin->stat_get = NULL; } + if (plugin->next_task != GNUNET_SCHEDULER_NO_TASK) + { + GNUNET_SCHEDULER_cancel (plugin->env->sched, + plugin->next_task); + plugin->next_task = GNUNET_SCHEDULER_NO_TASK; + } fn = NULL; if (plugin->drop_on_shutdown) fn = GNUNET_strdup (plugin->fn); |