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);
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);
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;
}
&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.
*
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);
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);
}
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,
(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,
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;
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,
GNUNET_CONSTANTS_SERVICE_TIMEOUT,
&sb_put_cont,
psc);
-
GNUNET_free (sb);
GNUNET_free (sb_enc);
}