From: Christian Grothoff Date: Fri, 14 May 2010 15:35:57 +0000 (+0000) Subject: fixes X-Git-Tag: initial-import-from-subversion-38251~21706 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a1b9bb7410e9c41e0b96eb70a54f06cebdc42258;p=oweals%2Fgnunet.git fixes --- diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 4e2039ba0..4d93579bd 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -117,6 +117,7 @@ publish_cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_FS_PublishContext *pc = cls; + GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL); if (pc->namespace != NULL) GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO); @@ -124,7 +125,10 @@ publish_cleanup (void *cls, GNUNET_free_non_null (pc->nuid); GNUNET_free_non_null (pc->serialization); if (pc->dsh != NULL) - GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); + { + GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); + pc->dsh = NULL; + } if (pc->client != NULL) GNUNET_CLIENT_disconnect (pc->client, GNUNET_NO); GNUNET_free (pc); @@ -997,6 +1001,11 @@ fip_signal_suspend(void *cls, pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND; GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, sc, fi, off)); *client_info = NULL; + if (NULL != sc->dsh) + { + GNUNET_DATASTORE_disconnect (sc->dsh, GNUNET_NO); + sc->dsh = NULL; + } return GNUNET_OK; } @@ -1021,12 +1030,10 @@ GNUNET_FS_publish_signal_suspend_ (void *cls) &fip_signal_suspend, pc); GNUNET_FS_end_top (pc->h, pc->top); - GNUNET_SCHEDULER_add_continuation (pc->h->sched, - &publish_cleanup, - pc, - GNUNET_SCHEDULER_REASON_PREREQ_DONE); + publish_cleanup (pc, NULL); } + /** * Publish a file or directory. * @@ -1152,6 +1159,11 @@ void GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) { GNUNET_FS_end_top (pc->h, pc->top); + if (NULL != pc->dsh) + { + GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); + pc->dsh = NULL; + } if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) { GNUNET_SCHEDULER_cancel (pc->h->sched, pc->upload_task); @@ -1171,10 +1183,7 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) pc->in_network_wait = GNUNET_SYSERR; return; } - GNUNET_SCHEDULER_add_continuation (pc->h->sched, - &publish_cleanup, - pc, - GNUNET_SCHEDULER_REASON_PREREQ_DONE); + publish_cleanup (pc, NULL); } @@ -1285,7 +1294,11 @@ kb_put_cont (void *cls, if (GNUNET_OK != success) { - GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); + if (NULL != pkc->dsh) + { + GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); + pkc->dsh = NULL; + } GNUNET_free (pkc->cpy); GNUNET_free (pkc->kb); pkc->cont (pkc->cont_cls, @@ -1326,7 +1339,10 @@ publish_ksk_cont (void *cls, (NULL == pkc->dsh) ) { if (NULL != pkc->dsh) - GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); + { + GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); + pkc->dsh = NULL; + } GNUNET_free (pkc->cpy); GNUNET_free (pkc->kb); pkc->cont (pkc->cont_cls, @@ -1452,7 +1468,10 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, GNUNET_break (0); GNUNET_free (pkc->kb); if (pkc->dsh != NULL) - GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); + { + GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO); + pkc->dsh = NULL; + } cont (cont_cls, NULL, _("Internal error.")); GNUNET_free (pkc); return; @@ -1518,7 +1537,10 @@ sb_put_cont (void *cls, struct PublishSksContext *psc = cls; if (NULL != psc->dsh) - GNUNET_DATASTORE_disconnect (psc->dsh, GNUNET_NO); + { + GNUNET_DATASTORE_disconnect (psc->dsh, GNUNET_NO); + psc->dsh = NULL; + } if (GNUNET_OK != success) psc->cont (psc->cont_cls, NULL, @@ -1685,7 +1707,6 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, GNUNET_CONSTANTS_SERVICE_TIMEOUT, &sb_put_cont, psc); - GNUNET_free (sb); GNUNET_free (sb_enc); } diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf index d65bce262..e7fea5450 100644 --- a/src/fs/fs_test_lib_data.conf +++ b/src/fs/fs_test_lib_data.conf @@ -20,7 +20,7 @@ HOSTNAME = localhost DEFAULTSERVICES = [datastore] -#DEBUG = YES +DEBUG = YES #PREFIX = valgrind --tool=memcheck --leak-check=yes #BINARY = /home/grothoff/bin/gnunet-service-datastore @@ -52,7 +52,7 @@ TOTAL_QUOTA_OUT = 3932160 PORT = 43471 HOSTNAME = localhost #OPTIONS = -L DEBUG -# DEBUG = YES +DEBUG = YES #PREFIX = valgrind --tool=memcheck --leak-check=yes #BINARY = /home/grothoff/bin/gnunet-service-fs #PREFIX = xterm -e gdb -x cmd --args diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index e85d99cfd..124bab521 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -2270,6 +2270,7 @@ process_local_reply (void *cls, anonymity, expiration, uid, &process_local_reply, pr)) + if (pr->qe != NULL) GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); return; } @@ -2291,7 +2292,8 @@ process_local_reply (void *cls, gettext_noop ("# results filtered by query bloomfilter"), 1, GNUNET_NO); - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + if (pr->qe != NULL) + GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); return; } #if DEBUG_FS @@ -2332,7 +2334,8 @@ process_local_reply (void *cls, if ( (type == GNUNET_BLOCK_TYPE_DBLOCK) || (type == GNUNET_BLOCK_TYPE_IBLOCK) ) { - GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); + if (pr->qe != NULL) + GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); return; } if ( (pr->client_request_list == NULL) && @@ -2347,10 +2350,12 @@ process_local_reply (void *cls, gettext_noop ("# processing result set cut short due to load"), 1, GNUNET_NO); - GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); + if (pr->qe != NULL) + GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); return; } - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + if (pr->qe != NULL) + GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); } diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 068095269..fdd0452c2 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c @@ -103,6 +103,13 @@ abort_publish_task (void *cls, } } +static void +stop_fs_task (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + GNUNET_FS_stop (fs); + fs = NULL; +} static void abort_download_task (void *cls, @@ -207,8 +214,9 @@ progress_cb (void *cls, GNUNET_assert (publish == event->value.publish.sc); GNUNET_assert (FILESIZE == event->value.publish.size); GNUNET_assert (1 == event->value.publish.anonymity); - GNUNET_FS_stop (fs); - fs = NULL; + GNUNET_SCHEDULER_add_now (sched, + &stop_fs_task, + NULL); break; case GNUNET_FS_STATUS_DOWNLOAD_START: GNUNET_assert (download == NULL); diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index 7e3e02c76..92ac44dcc 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c @@ -26,7 +26,7 @@ #include "platform.h" #include "fs_test_lib.h" -#define VERBOSE GNUNET_NO +#define VERBOSE GNUNET_YES /** * File-size we use for testing.